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

Answer key

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

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