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

Answer key

  1. 5
  2. chat messages to friends
  3. Monsoon
  4. use it on any device
  5. True
  6. a shared to-do list
  7. a draft you are typing
  8. Meera
  9. 0
  10. False
  11. photos on two devices
  12. notes to read offline
  13. 5
  14. Hindi
  15. a list
  16. False
  17. in the cloud
  18. 4
  19. in the cloud
  20. False
  21. Zoya
  22. 1
  23. True
  24. a named box for a value
  25. True
  26. on the phone
  27. in the cloud
  28. Maths
  29. True
  30. 7
  31. False
  32. 7
  33. 5
  34. False
  35. Maths
  36. the sound on/off setting
  37. on the phone
  38. Kabir
  39. Maths
  40. 3

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