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

Answer key

  1. 5
  2. a named box for a value
  3. on the phone
  4. on the phone
  5. use it on any device
  6. on the phone
  7. Maths
  8. a list
  9. 6
  10. a shared to-do list
  11. 6
  12. 2
  13. 5
  14. in the cloud
  15. your last game level
  16. Maths
  17. True
  18. Music
  19. a class leaderboard
  20. chat messages to friends
  21. Riya
  22. in the cloud
  23. 4
  24. in the cloud
  25. the phone is lost
  26. in the cloud
  27. Zoya
  28. photos on two devices
  29. 6
  30. 3
  31. Sports
  32. the sound on/off setting
  33. Kites
  34. 5
  35. False
  36. 3
  37. 6
  38. Aman
  39. False
  40. 5

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