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

Answer key

  1. Sunrise
  2. False
  3. a list
  4. 3
  5. Sports
  6. in the cloud
  7. chat messages to friends
  8. your last game level
  9. 6
  10. photos on two devices
  11. in the cloud
  12. Aman
  13. Ocean
  14. 8
  15. 4
  16. 6
  17. Monsoon
  18. a class leaderboard
  19. False
  20. 5
  21. 0
  22. False
  23. Art
  24. 5
  25. Stars
  26. Music
  27. False
  28. 6
  29. True
  30. 10
  31. notes to read offline
  32. Meera
  33. Zoya
  34. a shared to-do list
  35. in the cloud
  36. Maths
  37. True
  38. Arjun
  39. Sports
  40. a draft you are typing

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