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

Answer key

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

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