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

Answer key

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

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