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

Answer key

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

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