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

Answer key

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

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