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

Answer key

  1. Sports
  2. a shared to-do list
  3. 9
  4. Maths
  5. True
  6. Monsoon
  7. Rain
  8. Ocean
  9. False
  10. notes to read offline
  11. True
  12. 3
  13. 0
  14. 4
  15. the phone is lost
  16. on the phone
  17. chat messages to friends
  18. on the phone
  19. False
  20. in the cloud
  21. Aman
  22. a named box for a value
  23. Riya
  24. a class leaderboard
  25. a list
  26. 5
  27. Kabir
  28. 5
  29. on the phone
  30. 2
  31. 5
  32. use it on any device
  33. False
  34. Science
  35. Arjun
  36. a draft you are typing
  37. Science
  38. Music
  39. Kites
  40. False

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