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

Answer key

  1. True
  2. 7
  3. Sports
  4. on the phone
  5. 6
  6. 0
  7. a list
  8. Maths
  9. 3
  10. Kabir
  11. on the phone
  12. 5
  13. Maths
  14. the phone is lost
  15. False
  16. on the phone
  17. True
  18. Art
  19. your last game level
  20. a shared to-do list
  21. use it on any device
  22. in the cloud
  23. in the cloud
  24. on the phone
  25. Ocean
  26. a named box for a value
  27. 11
  28. Maths
  29. 5
  30. False
  31. in the cloud
  32. Art
  33. in the cloud
  34. Meera
  35. True
  36. notes to read offline
  37. False
  38. Sunrise
  39. 3
  40. Hindi

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