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

Answer key

  1. Meera
  2. True
  3. use it on any device
  4. 3
  5. True
  6. Aman
  7. in the cloud
  8. 9
  9. a draft you are typing
  10. on the phone
  11. 3
  12. your last game level
  13. False
  14. the phone is lost
  15. a named box for a value
  16. 3
  17. a class leaderboard
  18. True
  19. Music
  20. a list
  21. 5
  22. Kites
  23. on the phone
  24. 6
  25. in the cloud
  26. False
  27. in the cloud
  28. 5
  29. on the phone
  30. 6
  31. False
  32. photos on two devices
  33. 4
  34. 6
  35. 3
  36. a shared to-do list
  37. 3
  38. in the cloud
  39. Meera
  40. Sports

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