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

Answer key

  1. 5
  2. 2
  3. True
  4. in the cloud
  5. False
  6. your last game level
  7. Maths
  8. on the phone
  9. Monsoon
  10. 10
  11. True
  12. 6
  13. False
  14. photos on two devices
  15. on the phone
  16. Meera
  17. a class leaderboard
  18. a list
  19. False
  20. 4
  21. 5
  22. False
  23. the sound on/off setting
  24. 5
  25. False
  26. 4
  27. False
  28. Stars
  29. 5
  30. 0
  31. a named box for a value
  32. 6
  33. Aman
  34. 6
  35. 5
  36. notes to read offline
  37. 5
  38. Riya
  39. Music
  40. Arjun

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