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

Answer key

  1. 5
  2. 5
  3. False
  4. False
  5. a named box for a value
  6. a list
  7. use it on any device
  8. False
  9. True
  10. Meera
  11. 4
  12. Kabir
  13. True
  14. True
  15. False
  16. Kabir
  17. Arjun
  18. 4
  19. 5
  20. the sound on/off setting
  21. Sports
  22. 6
  23. notes to read offline
  24. your last game level
  25. on the phone
  26. photos on two devices
  27. Kabir
  28. in the cloud
  29. data saved on the phone
  30. True
  31. the phone is lost
  32. 6
  33. Rain
  34. 0
  35. Arjun
  36. a class leaderboard
  37. 3
  38. a draft you are typing
  39. Zoya
  40. in the cloud

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