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

Answer key

  1. 6
  2. photos on two devices
  3. in the cloud
  4. 3
  5. 3
  6. a named box for a value
  7. 5
  8. the sound on/off setting
  9. a shared to-do list
  10. Monsoon
  11. False
  12. True
  13. use it on any device
  14. Maths
  15. on the phone
  16. Music
  17. data saved on the phone
  18. 4
  19. Riya
  20. 7
  21. False
  22. 5
  23. the phone is lost
  24. 0
  25. a draft you are typing
  26. 6
  27. Monsoon
  28. in the cloud
  29. Sports
  30. a list
  31. 5
  32. Maths
  33. on the phone
  34. 2
  35. False
  36. Arjun
  37. False
  38. True
  39. Stars
  40. Music

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