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

Answer key

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

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