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

Answer key

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

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