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

Answer key

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

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