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

Answer key

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

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