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

Answer key

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

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