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

Answer key

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

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