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

Answer key

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

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