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

Answer key

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

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