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

Answer key

  1. in the cloud
  2. Monsoon
  3. Maths
  4. 6
  5. False
  6. Maths
  7. in the cloud
  8. 6
  9. 7
  10. 0
  11. 6
  12. a class leaderboard
  13. Rain
  14. a named box for a value
  15. 5
  16. Rain
  17. False
  18. False
  19. data saved on the phone
  20. 5
  21. in the cloud
  22. Zoya
  23. a shared to-do list
  24. on the phone
  25. True
  26. Maths
  27. Art
  28. the sound on/off setting
  29. photos on two devices
  30. 4
  31. Aman
  32. a list
  33. on the phone
  34. 7
  35. 4
  36. 4
  37. False
  38. 3
  39. 5
  40. your last game level

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