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

Answer key

  1. 6
  2. Music
  3. the sound on/off setting
  4. False
  5. 5
  6. True
  7. 6
  8. on the phone
  9. 3
  10. 5
  11. True
  12. in the cloud
  13. Sunrise
  14. 11
  15. a list
  16. 5
  17. notes to read offline
  18. Kites
  19. 5
  20. a named box for a value
  21. False
  22. 6
  23. on the phone
  24. Kites
  25. 7
  26. in the cloud
  27. 6
  28. 5
  29. chat messages to friends
  30. False
  31. in the cloud
  32. a draft you are typing
  33. Science
  34. data saved on the phone
  35. 3
  36. your last game level
  37. False
  38. 5
  39. on the phone
  40. False

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