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

Answer key

  1. in the cloud
  2. 5
  3. Ocean
  4. the phone is lost
  5. Hindi
  6. Ocean
  7. 3
  8. chat messages to friends
  9. Riya
  10. a list
  11. Maths
  12. Stars
  13. True
  14. a named box for a value
  15. on the phone
  16. 8
  17. 3
  18. Ocean
  19. True
  20. in the cloud
  21. 3
  22. 3
  23. on the phone
  24. 1
  25. 3
  26. 6
  27. notes to read offline
  28. False
  29. 5
  30. Stars
  31. on the phone
  32. 5
  33. a draft you are typing
  34. True
  35. 7
  36. 2
  37. 4
  38. 5
  39. your last game level
  40. 4

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