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

Answer key

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

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