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

Answer key

  1. 6
  2. 0
  3. Art
  4. 6
  5. 3
  6. on the phone
  7. in the cloud
  8. True
  9. 3
  10. 4
  11. in the cloud
  12. 3
  13. a named box for a value
  14. photos on two devices
  15. 6
  16. False
  17. 4
  18. False
  19. Ocean
  20. 4
  21. data saved on the phone
  22. 5
  23. a draft you are typing
  24. use it on any device
  25. 5
  26. your last game level
  27. 4
  28. 1
  29. a list
  30. on the phone
  31. 5
  32. Riya
  33. 3
  34. Sunrise
  35. 7
  36. Arjun
  37. Zoya
  38. False
  39. on the phone
  40. 6

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