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

Answer key

  1. 5
  2. notes to read offline
  3. on the phone
  4. in the cloud
  5. 3
  6. the sound on/off setting
  7. True
  8. 6
  9. True
  10. a list
  11. Arjun
  12. True
  13. chat messages to friends
  14. 0
  15. Kabir
  16. Art
  17. a draft you are typing
  18. 6
  19. 3
  20. Riya
  21. False
  22. 4
  23. a shared to-do list
  24. in the cloud
  25. 3
  26. on the phone
  27. Aman
  28. Science
  29. on the phone
  30. False
  31. Monsoon
  32. 7
  33. True
  34. Maths
  35. True
  36. Kabir
  37. 6
  38. Stars
  39. 1
  40. on the phone

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