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

Answer key

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

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