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

Answer key

  1. False
  2. Arjun
  3. Sports
  4. 4
  5. 11
  6. Zoya
  7. Aman
  8. the sound on/off setting
  9. a draft you are typing
  10. the phone is lost
  11. on the phone
  12. photos on two devices
  13. True
  14. chat messages to friends
  15. a list
  16. 9
  17. True
  18. 3
  19. a shared to-do list
  20. in the cloud
  21. 9
  22. a named box for a value
  23. Maths
  24. 0
  25. Monsoon
  26. Rain
  27. False
  28. Maths
  29. in the cloud
  30. Rain
  31. 7
  32. Art
  33. False
  34. False
  35. Rain
  36. Kites
  37. Zoya
  38. True
  39. 3
  40. on the phone

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