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

Answer key

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

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