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

Answer key

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

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