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

Answer key

  1. 7
  2. in the cloud
  3. Meera
  4. 3
  5. 0
  6. data saved on the phone
  7. on the phone
  8. a named box for a value
  9. True
  10. 8
  11. chat messages to friends
  12. Meera
  13. your last game level
  14. 6
  15. 5
  16. Maths
  17. Zoya
  18. on the phone
  19. 4
  20. 4
  21. False
  22. True
  23. Stars
  24. 7
  25. True
  26. the sound on/off setting
  27. Music
  28. Stars
  29. in the cloud
  30. Ocean
  31. use it on any device
  32. a shared to-do list
  33. Sports
  34. True
  35. True
  36. Sports
  37. 5
  38. Zoya
  39. Aman
  40. photos on two devices

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