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

Answer key

  1. a named box for a value
  2. data saved on the phone
  3. a list
  4. the sound on/off setting
  5. your last game level
  6. in the cloud
  7. False
  8. Sports
  9. 4
  10. in the cloud
  11. in the cloud
  12. on the phone
  13. 3
  14. 5
  15. 2
  16. 6
  17. Stars
  18. chat messages to friends
  19. Monsoon
  20. True
  21. False
  22. on the phone
  23. Sunrise
  24. Sports
  25. the phone is lost
  26. 6
  27. 5
  28. on the phone
  29. 0
  30. on the phone
  31. 6
  32. True
  33. True
  34. 12
  35. use it on any device
  36. 5
  37. Arjun
  38. 6
  39. True
  40. Hindi

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