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

Answer key

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

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