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

Answer key

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

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