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

Answer key

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

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