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

Answer key

  1. True
  2. False
  3. on the phone
  4. a draft you are typing
  5. 1
  6. use it on any device
  7. Kites
  8. 3
  9. in the cloud
  10. your last game level
  11. on the phone
  12. Zoya
  13. Kites
  14. 3
  15. 4
  16. False
  17. a named box for a value
  18. 3
  19. Kabir
  20. Monsoon
  21. a list
  22. Sports
  23. in the cloud
  24. False
  25. 5
  26. False
  27. True
  28. a class leaderboard
  29. 5
  30. 4
  31. True
  32. in the cloud
  33. 6
  34. 5
  35. 8
  36. the sound on/off setting
  37. Meera
  38. Rain
  39. 4
  40. 10

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