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

Answer key

  1. 8
  2. 3
  3. 0
  4. 3
  5. False
  6. False
  7. 1
  8. 3
  9. on the phone
  10. data saved on the phone
  11. notes to read offline
  12. 4
  13. 10
  14. a class leaderboard
  15. Sunrise
  16. your last game level
  17. in the cloud
  18. a named box for a value
  19. True
  20. Zoya
  21. photos on two devices
  22. False
  23. Rain
  24. a draft you are typing
  25. True
  26. the phone is lost
  27. on the phone
  28. in the cloud
  29. False
  30. 3
  31. False
  32. 3
  33. 2
  34. Meera
  35. a list
  36. on the phone
  37. Rain
  38. 6
  39. 5
  40. False

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