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

Answer key

  1. notes to read offline
  2. the sound on/off setting
  3. 5
  4. a named box for a value
  5. chat messages to friends
  6. Riya
  7. Sports
  8. False
  9. a list
  10. True
  11. 0
  12. data saved on the phone
  13. in the cloud
  14. False
  15. photos on two devices
  16. 6
  17. use it on any device
  18. 5
  19. True
  20. in the cloud
  21. 5
  22. 5
  23. True
  24. Ocean
  25. Maths
  26. Art
  27. Kabir
  28. Stars
  29. 5
  30. the phone is lost
  31. on the phone
  32. Art
  33. False
  34. 6
  35. Sunrise
  36. 6
  37. a draft you are typing
  38. Zoya
  39. True
  40. 5

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