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

Answer key

  1. False
  2. 2
  3. Hindi
  4. 4
  5. photos on two devices
  6. 2
  7. use it on any device
  8. a shared to-do list
  9. False
  10. Riya
  11. 5
  12. 5
  13. 0
  14. 5
  15. notes to read offline
  16. Hindi
  17. Sports
  18. 3
  19. Kabir
  20. your last game level
  21. chat messages to friends
  22. a list
  23. in the cloud
  24. False
  25. Stars
  26. 5
  27. a class leaderboard
  28. 4
  29. Kabir
  30. on the phone
  31. 3
  32. Maths
  33. 6
  34. 3
  35. 5
  36. Aman
  37. Kites
  38. Stars
  39. 3
  40. Ocean

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