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

Answer key

  1. a list
  2. in the cloud
  3. 2
  4. 0
  5. True
  6. Maths
  7. a named box for a value
  8. a draft you are typing
  9. False
  10. Zoya
  11. on the phone
  12. data saved on the phone
  13. your last game level
  14. photos on two devices
  15. Riya
  16. in the cloud
  17. False
  18. 6
  19. Maths
  20. in the cloud
  21. 3
  22. the phone is lost
  23. 2
  24. 3
  25. on the phone
  26. a class leaderboard
  27. Meera
  28. in the cloud
  29. Science
  30. Monsoon
  31. 2
  32. 4
  33. on the phone
  34. Art
  35. False
  36. 3
  37. notes to read offline
  38. 1
  39. 7
  40. 4

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