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

Answer key

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

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