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

Answer key

  1. 5
  2. in the cloud
  3. a class leaderboard
  4. True
  5. a named box for a value
  6. a list
  7. the sound on/off setting
  8. Kabir
  9. Monsoon
  10. in the cloud
  11. False
  12. Aman
  13. Kabir
  14. 5
  15. 5
  16. False
  17. Kites
  18. a draft you are typing
  19. 0
  20. 8
  21. 4
  22. on the phone
  23. on the phone
  24. Kites
  25. 3
  26. False
  27. 6
  28. 4
  29. 5
  30. your last game level
  31. in the cloud
  32. 3
  33. True
  34. 7
  35. Riya
  36. Meera
  37. Art
  38. False
  39. True
  40. chat messages to friends

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