← Data: variables, lists and saving lesson New set →

App Dev Worksheet: Variables, Lists and Saving

App development lesson 15: Data: variables, lists and saving · Set 212 · 40 questions
TalentJR

Developer's tip (Box, list, place): A variable holds one value; a list holds many in order. Positions start at 0. push adds to the end; pop takes off the last item; length is how many items. On the phone: works offline, private. In the cloud: shared, any device, needs the internet.

NameDateTime takenScore ___ / 40
  1. 1.💾 What number does this code show?
    let points = 9;
    points = points - 2;
    points = points + 5;
    show(points);
  2. 2.💾 pop() takes off the last item. What does this code show?
    let songs = ["Monsoon", "Stars", "Ocean", "Rain"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Stars (b) Ocean (c) Monsoon (d) Rain
  3. 3.💾 What number does this code show?
    let songs = ["Sunrise", "Stars", "Ocean"];
    songs.push("Monsoon");
    songs.push("Kites");
    show(songs.length);
  4. 4.💾 What number does this code show?
    let score = 7;
    score = score - 3;
    score = score + 2;
    show(score);
  5. 5.True or false: a class leaderboard fits saving in the cloud. (a) False (b) True
  6. 6.💾 What does this code show? (Positions start at 0.)
    let friends = ["Zoya", "Riya", "Meera"];
    show(friends[2]);
    (a) Riya (b) Meera (c) Zoya
  7. 7.💾 Where should the app save the sound on/off setting: on the phone or in the cloud? (a) on the phone (b) in the cloud
  8. 8.True or false: the sound on/off setting fits saving in the cloud. (a) True (b) False
  9. 9.Which of these fits saving in the cloud? (a) your last game level (b) notes to read offline (c) a shared to-do list (d) the sound on/off setting
  10. 10.💾 What number does this code show?
    let coins = 8;
    coins = coins - 7;
    coins = coins + 4;
    show(coins);
  11. 11.💾 In most code, the first item of a list is at position ___. (a) 10 (b) 2 (c) 0 (d) 1
  12. 12.💾 Data saved only on the phone is lost when ___. (a) you send a message (b) the phone is lost (c) the app is closed (d) the screen turns off
  13. 13.True or false: the sound on/off setting fits saving on the phone. (a) False (b) True
  14. 14.💾 What does this code show? (Positions start at 0.)
    let songs = ["Rain", "Stars", "Sunrise", "Kites", "Monsoon"];
    show(songs[0]);
    (a) Sunrise (b) Kites (c) Rain (d) Stars
  15. 15.💾 What number does this code show?
    let coins = 6;
    coins = coins - 2;
    coins = coins + 3;
    show(coins);
  16. 16.True or false: notes to read offline fits saving in the cloud. (a) True (b) False
  17. 17.💾 What number does this code show?
    let score = 3;
    score = score - 3;
    score = score + 5;
    show(score);
  18. 18.💾 Where should the app save a draft you are typing: on the phone or in the cloud? (a) in the cloud (b) on the phone
  19. 19.💾 What does this code show? (Positions start at 0.)
    let notes = ["Science", "Hindi", "Art", "Maths"];
    show(notes[3]);
    (a) Science (b) Art (c) Hindi (d) Maths
  20. 20.💾 What number does this code show?
    let songs = ["Kites", "Sunrise", "Monsoon"];
    songs.push("Rain");
    show(songs.length);
  21. 21.💾 What does this code show? (Positions start at 0.)
    let songs = ["Kites", "Stars", "Monsoon", "Ocean"];
    show(songs[1]);
    (a) Stars (b) Monsoon (c) Kites (d) Ocean
  22. 22.💾 pop() takes off the last item. What does this code show?
    let friends = ["Aman", "Arjun", "Meera", "Zoya"];
    friends.pop();
    show(friends[friends.length - 1]);
    (a) Aman (b) Arjun (c) Zoya (d) Meera
  23. 23.Which of these fits saving on the phone? (a) your last game level (b) a class leaderboard (c) a shared to-do list (d) photos on two devices
  24. 24.💾 Which works with no internet at all? (a) a cloud leaderboard (b) a shared chat (c) a cloud backup (d) data saved on the phone
  25. 25.💾 What is a variable? (a) a named box for a value (b) a type of screen (c) a phone setting (d) a picture
  26. 26.True or false: chat messages to friends fits saving in the cloud. (a) False (b) True
  27. 27.💾 Where should the app save photos on two devices: on the phone or in the cloud? (a) in the cloud (b) on the phone
  28. 28.💾 What number does this code show?
    let friends = ["Riya", "Aman"];
    friends.push("Zoya");
    friends.push("Kabir");
    show(friends.length);
  29. 29.Which of these fits saving on the phone? (a) a class leaderboard (b) notes to read offline (c) photos on two devices (d) a shared to-do list
  30. 30.💾 What number does this code show?
    let songs = ["Monsoon", "Sunrise"];
    songs.push("Ocean");
    songs.push("Rain");
    show(songs.length);
  31. 31.💾 Which can hold many values in order? (a) a switch (b) a single number (c) a button (d) a list
  32. 32.💾 What number does this code show?
    let notes = ["Maths", "Art"];
    notes.push("Hindi");
    show(notes.length);
  33. 33.Which of these fits saving on the phone? (a) a draft you are typing (b) a shared to-do list (c) photos on two devices (d) a class leaderboard
  34. 34.💾 What number does this code show?
    let notes = ["Science", "Sports", "Hindi"];
    notes.push("Maths");
    notes.push("Music");
    show(notes.length);
  35. 35.Which of these fits saving in the cloud? (a) your last game level (b) a draft you are typing (c) notes to read offline (d) photos on two devices
  36. 36.💾 Where should the app save a class leaderboard: on the phone or in the cloud? (a) in the cloud (b) on the phone
  37. 37.💾 What number does this code show?
    let friends = ["Zoya", "Riya", "Kabir"];
    friends.push("Arjun");
    friends.push("Aman");
    show(friends.length);
  38. 38.True or false: a class leaderboard fits saving on the phone. (a) False (b) True
  39. 39.💾 What number does this code show?
    let points = 4;
    points = points - 1;
    points = points + 5;
    show(points);
  40. 40.💾 What does this code show? (Positions start at 0.)
    let songs = ["Ocean", "Monsoon", "Kites", "Sunrise"];
    show(songs[0]);
    (a) Monsoon (b) Ocean (c) Sunrise (d) Kites

Answer key

  1. 12
  2. Ocean
  3. 5
  4. 6
  5. True
  6. Meera
  7. on the phone
  8. False
  9. a shared to-do list
  10. 5
  11. 0
  12. the phone is lost
  13. True
  14. Rain
  15. 7
  16. False
  17. 5
  18. on the phone
  19. Maths
  20. 4
  21. Stars
  22. Meera
  23. your last game level
  24. data saved on the phone
  25. a named box for a value
  26. True
  27. in the cloud
  28. 4
  29. notes to read offline
  30. 4
  31. a list
  32. 3
  33. a draft you are typing
  34. 5
  35. photos on two devices
  36. in the cloud
  37. 5
  38. False
  39. 8
  40. Ocean

Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students