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

Answer key

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

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