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

Answer key

  1. on the phone
  2. Meera
  3. Art
  4. False
  5. Music
  6. 3
  7. 3
  8. a named box for a value
  9. Rain
  10. Arjun
  11. Aman
  12. a list
  13. a class leaderboard
  14. 3
  15. True
  16. on the phone
  17. the phone is lost
  18. False
  19. a draft you are typing
  20. True
  21. chat messages to friends
  22. 3
  23. Sunrise
  24. True
  25. 4
  26. Meera
  27. photos on two devices
  28. 3
  29. 1
  30. your last game level
  31. False
  32. on the phone
  33. True
  34. 0
  35. a shared to-do list
  36. 10
  37. 3
  38. Ocean
  39. 6
  40. 7

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