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

Answer key

  1. 6
  2. on the phone
  3. photos on two devices
  4. 10
  5. 7
  6. on the phone
  7. the sound on/off setting
  8. the phone is lost
  9. a draft you are typing
  10. use it on any device
  11. True
  12. True
  13. False
  14. Rain
  15. Hindi
  16. 0
  17. Hindi
  18. 4
  19. 4
  20. Zoya
  21. Monsoon
  22. True
  23. 6
  24. Riya
  25. 8
  26. 9
  27. False
  28. Sports
  29. a list
  30. in the cloud
  31. 4
  32. 3
  33. Riya
  34. notes to read offline
  35. 5
  36. Sunrise
  37. Maths
  38. your last game level
  39. Rain
  40. 5

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