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

Answer key

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

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