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

Answer key

  1. Kites
  2. on the phone
  3. Hindi
  4. Hindi
  5. a shared to-do list
  6. chat messages to friends
  7. use it on any device
  8. False
  9. on the phone
  10. a list
  11. a named box for a value
  12. 3
  13. in the cloud
  14. Aman
  15. on the phone
  16. True
  17. True
  18. Sports
  19. Maths
  20. Music
  21. in the cloud
  22. False
  23. in the cloud
  24. a class leaderboard
  25. True
  26. your last game level
  27. Sunrise
  28. Art
  29. 6
  30. True
  31. 4
  32. Art
  33. 3
  34. data saved on the phone
  35. True
  36. Riya
  37. False
  38. False
  39. 4
  40. 3

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