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

Answer key

  1. in the cloud
  2. on the phone
  3. Music
  4. your last game level
  5. chat messages to friends
  6. Sunrise
  7. True
  8. on the phone
  9. 3
  10. Stars
  11. False
  12. Riya
  13. True
  14. the phone is lost
  15. 5
  16. Maths
  17. Science
  18. Stars
  19. 1
  20. a list
  21. True
  22. 0
  23. Sunrise
  24. in the cloud
  25. 4
  26. data saved on the phone
  27. in the cloud
  28. Riya
  29. on the phone
  30. 8
  31. Ocean
  32. 4
  33. 5
  34. False
  35. a draft you are typing
  36. Kabir
  37. photos on two devices
  38. 3
  39. Sunrise
  40. a named box for a value

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