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

Answer key

  1. on the phone
  2. 5
  3. 5
  4. your last game level
  5. chat messages to friends
  6. 5
  7. True
  8. False
  9. True
  10. False
  11. Sports
  12. 4
  13. 7
  14. a list
  15. on the phone
  16. Science
  17. a named box for a value
  18. False
  19. Zoya
  20. Zoya
  21. 0
  22. in the cloud
  23. notes to read offline
  24. True
  25. Ocean
  26. 5
  27. in the cloud
  28. a shared to-do list
  29. Ocean
  30. on the phone
  31. 3
  32. Ocean
  33. a draft you are typing
  34. Art
  35. 6
  36. 6
  37. Science
  38. data saved on the phone
  39. Zoya
  40. Maths

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