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

Answer key

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

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