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

Answer key

  1. 3
  2. 5
  3. on the phone
  4. 7
  5. Music
  6. 2
  7. 3
  8. Kites
  9. False
  10. True
  11. a class leaderboard
  12. a named box for a value
  13. Monsoon
  14. True
  15. False
  16. False
  17. Riya
  18. 9
  19. in the cloud
  20. 3
  21. Rain
  22. Riya
  23. 3
  24. Stars
  25. 6
  26. Riya
  27. a draft you are typing
  28. in the cloud
  29. 6
  30. False
  31. True
  32. a list
  33. Riya
  34. 5
  35. Sunrise
  36. in the cloud
  37. a shared to-do list
  38. on the phone
  39. Science
  40. Stars

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