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

Answer key

  1. Hindi
  2. Music
  3. Sports
  4. Monsoon
  5. data saved on the phone
  6. True
  7. 5
  8. 3
  9. in the cloud
  10. notes to read offline
  11. in the cloud
  12. 3
  13. a list
  14. in the cloud
  15. 5
  16. 4
  17. Meera
  18. in the cloud
  19. True
  20. a named box for a value
  21. a shared to-do list
  22. Zoya
  23. 4
  24. Arjun
  25. Science
  26. False
  27. Aman
  28. on the phone
  29. Sunrise
  30. True
  31. 0
  32. Art
  33. 4
  34. use it on any device
  35. Monsoon
  36. photos on two devices
  37. Rain
  38. Arjun
  39. on the phone
  40. Rain

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