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

Answer key

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

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