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

Answer key

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

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