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

Answer key

  1. Zoya
  2. data saved on the phone
  3. the phone is lost
  4. on the phone
  5. 5
  6. in the cloud
  7. your last game level
  8. 7
  9. Meera
  10. 4
  11. False
  12. Rain
  13. Ocean
  14. False
  15. in the cloud
  16. Riya
  17. use it on any device
  18. in the cloud
  19. a shared to-do list
  20. a draft you are typing
  21. Meera
  22. on the phone
  23. Kites
  24. 8
  25. Art
  26. Riya
  27. 0
  28. on the phone
  29. 3
  30. Monsoon
  31. 2
  32. True
  33. Zoya
  34. 6
  35. 8
  36. False
  37. photos on two devices
  38. Music
  39. a list
  40. Maths

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