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

Answer key

  1. Riya
  2. False
  3. Ocean
  4. on the phone
  5. 6
  6. Science
  7. Meera
  8. a class leaderboard
  9. data saved on the phone
  10. the phone is lost
  11. True
  12. your last game level
  13. 5
  14. True
  15. False
  16. 4
  17. Kites
  18. Meera
  19. 6
  20. the sound on/off setting
  21. True
  22. False
  23. a named box for a value
  24. Stars
  25. in the cloud
  26. use it on any device
  27. 3
  28. False
  29. on the phone
  30. a list
  31. 4
  32. 4
  33. in the cloud
  34. Science
  35. 3
  36. Monsoon
  37. True
  38. 0
  39. Riya
  40. 4

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