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

Answer key

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

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