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

Answer key

  1. True
  2. notes to read offline
  3. Science
  4. False
  5. 0
  6. a draft you are typing
  7. chat messages to friends
  8. in the cloud
  9. 3
  10. a named box for a value
  11. 3
  12. Meera
  13. False
  14. data saved on the phone
  15. use it on any device
  16. on the phone
  17. 5
  18. True
  19. 5
  20. Kabir
  21. 4
  22. the sound on/off setting
  23. True
  24. Ocean
  25. True
  26. Sports
  27. True
  28. on the phone
  29. in the cloud
  30. 5
  31. a list
  32. Aman
  33. False
  34. False
  35. Arjun
  36. 5
  37. Ocean
  38. Hindi
  39. Rain
  40. Sunrise

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