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

Answer key

  1. a list
  2. on the phone
  3. 4
  4. Sports
  5. False
  6. True
  7. in the cloud
  8. photos on two devices
  9. 4
  10. Kabir
  11. a draft you are typing
  12. notes to read offline
  13. 5
  14. False
  15. Sports
  16. Kabir
  17. on the phone
  18. 0
  19. a named box for a value
  20. 6
  21. 4
  22. 5
  23. 7
  24. in the cloud
  25. Stars
  26. Aman
  27. 3
  28. 7
  29. False
  30. 5
  31. Monsoon
  32. Stars
  33. Meera
  34. Hindi
  35. Rain
  36. the sound on/off setting
  37. 6
  38. 5
  39. False
  40. on the phone

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