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

Answer key

  1. in the cloud
  2. 6
  3. 6
  4. a list
  5. Sports
  6. Science
  7. Riya
  8. 7
  9. in the cloud
  10. True
  11. True
  12. Art
  13. Rain
  14. chat messages to friends
  15. 4
  16. a class leaderboard
  17. 5
  18. the sound on/off setting
  19. 3
  20. False
  21. on the phone
  22. 6
  23. a shared to-do list
  24. True
  25. the phone is lost
  26. 2
  27. 6
  28. False
  29. True
  30. 7
  31. notes to read offline
  32. Sunrise
  33. 6
  34. your last game level
  35. 6
  36. True
  37. False
  38. False
  39. Music
  40. 3

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