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

Answer key

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

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