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

Answer key

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

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