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

Answer key

  1. 4
  2. Rain
  3. 4
  4. True
  5. 4
  6. Arjun
  7. Maths
  8. use it on any device
  9. notes to read offline
  10. Rain
  11. Hindi
  12. True
  13. a named box for a value
  14. 6
  15. True
  16. 4
  17. a shared to-do list
  18. 7
  19. chat messages to friends
  20. Hindi
  21. the sound on/off setting
  22. on the phone
  23. False
  24. Hindi
  25. True
  26. 4
  27. 0
  28. the phone is lost
  29. 4
  30. 4
  31. 3
  32. 3
  33. Sports
  34. in the cloud
  35. Zoya
  36. False
  37. Stars
  38. 4
  39. Rain
  40. on the phone

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