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

Answer key

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

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