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

Answer key

  1. 5
  2. a named box for a value
  3. 5
  4. Aman
  5. on the phone
  6. Arjun
  7. Riya
  8. the sound on/off setting
  9. in the cloud
  10. Meera
  11. in the cloud
  12. 3
  13. on the phone
  14. the phone is lost
  15. your last game level
  16. Music
  17. 2
  18. 4
  19. a class leaderboard
  20. 0
  21. Zoya
  22. a list
  23. Science
  24. 2
  25. True
  26. 5
  27. False
  28. 7
  29. True
  30. True
  31. Sunrise
  32. a shared to-do list
  33. on the phone
  34. 4
  35. 5
  36. data saved on the phone
  37. Music
  38. Maths
  39. False
  40. a draft you are typing

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