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

Answer key

  1. Aman
  2. False
  3. True
  4. 4
  5. your last game level
  6. Ocean
  7. Ocean
  8. use it on any device
  9. True
  10. 0
  11. 3
  12. the sound on/off setting
  13. 5
  14. a shared to-do list
  15. False
  16. 5
  17. notes to read offline
  18. Stars
  19. 9
  20. False
  21. Sports
  22. 7
  23. chat messages to friends
  24. in the cloud
  25. Rain
  26. Kites
  27. the phone is lost
  28. Monsoon
  29. Science
  30. Maths
  31. 3
  32. True
  33. 5
  34. in the cloud
  35. False
  36. Arjun
  37. True
  38. 4
  39. Music
  40. in the cloud

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