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

Answer key

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

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