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

Answer key

  1. in the cloud
  2. True
  3. a list
  4. Monsoon
  5. 4
  6. 11
  7. 4
  8. 8
  9. in the cloud
  10. 0
  11. 5
  12. chat messages to friends
  13. a class leaderboard
  14. 6
  15. True
  16. on the phone
  17. Aman
  18. the phone is lost
  19. 4
  20. 4
  21. Monsoon
  22. a named box for a value
  23. False
  24. photos on two devices
  25. 3
  26. Aman
  27. Kabir
  28. on the phone
  29. in the cloud
  30. 3
  31. 5
  32. the sound on/off setting
  33. 5
  34. Sunrise
  35. 12
  36. Art
  37. True
  38. notes to read offline
  39. 4
  40. 6

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