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

Answer key

  1. 4
  2. a list
  3. in the cloud
  4. chat messages to friends
  5. Ocean
  6. on the phone
  7. Music
  8. True
  9. Music
  10. the phone is lost
  11. in the cloud
  12. a named box for a value
  13. 4
  14. on the phone
  15. 4
  16. Aman
  17. Stars
  18. Aman
  19. False
  20. the sound on/off setting
  21. a draft you are typing
  22. Zoya
  23. 4
  24. Science
  25. use it on any device
  26. Arjun
  27. photos on two devices
  28. a class leaderboard
  29. 4
  30. on the phone
  31. 4
  32. True
  33. in the cloud
  34. False
  35. 7
  36. Rain
  37. on the phone
  38. Meera
  39. 7
  40. Hindi

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