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

Answer key

  1. 4
  2. 3
  3. a list
  4. False
  5. Sunrise
  6. Kabir
  7. chat messages to friends
  8. 0
  9. 5
  10. True
  11. the sound on/off setting
  12. Zoya
  13. False
  14. the phone is lost
  15. 5
  16. False
  17. Zoya
  18. in the cloud
  19. Kites
  20. in the cloud
  21. data saved on the phone
  22. Arjun
  23. a named box for a value
  24. Sports
  25. Art
  26. your last game level
  27. True
  28. notes to read offline
  29. Sports
  30. True
  31. Kites
  32. Ocean
  33. Sunrise
  34. 6
  35. 9
  36. Music
  37. 3
  38. on the phone
  39. photos on two devices
  40. 5

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