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

Answer key

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

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