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

Answer key

  1. a list
  2. True
  3. Monsoon
  4. 4
  5. Zoya
  6. 6
  7. True
  8. chat messages to friends
  9. the phone is lost
  10. a class leaderboard
  11. 5
  12. False
  13. True
  14. a named box for a value
  15. Riya
  16. Riya
  17. Music
  18. data saved on the phone
  19. in the cloud
  20. Zoya
  21. True
  22. 5
  23. Rain
  24. 4
  25. False
  26. in the cloud
  27. True
  28. 5
  29. False
  30. your last game level
  31. Science
  32. a draft you are typing
  33. 5
  34. Rain
  35. 5
  36. 3
  37. Kites
  38. 5
  39. Ocean
  40. 6

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