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

Answer key

  1. your last game level
  2. a draft you are typing
  3. Aman
  4. True
  5. 4
  6. in the cloud
  7. on the phone
  8. on the phone
  9. a named box for a value
  10. False
  11. 6
  12. a list
  13. False
  14. Maths
  15. False
  16. Kabir
  17. 4
  18. in the cloud
  19. notes to read offline
  20. photos on two devices
  21. Stars
  22. 6
  23. on the phone
  24. Rain
  25. True
  26. Zoya
  27. 3
  28. on the phone
  29. Hindi
  30. in the cloud
  31. in the cloud
  32. chat messages to friends
  33. Meera
  34. 9
  35. 4
  36. Maths
  37. Music
  38. Maths
  39. 0
  40. 4

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