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

Answer key

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

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