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

Answer key

  1. True
  2. the sound on/off setting
  3. 6
  4. 0
  5. in the cloud
  6. 5
  7. 3
  8. False
  9. 4
  10. True
  11. 11
  12. True
  13. 4
  14. use it on any device
  15. Sports
  16. 6
  17. in the cloud
  18. True
  19. the phone is lost
  20. False
  21. on the phone
  22. on the phone
  23. False
  24. a draft you are typing
  25. 5
  26. Music
  27. 4
  28. Kites
  29. 4
  30. 9
  31. Kites
  32. in the cloud
  33. 5
  34. 4
  35. a list
  36. 5
  37. 5
  38. Ocean
  39. on the phone
  40. on the phone

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