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

Answer key

  1. a class leaderboard
  2. Arjun
  3. Ocean
  4. a list
  5. a shared to-do list
  6. on the phone
  7. in the cloud
  8. 4
  9. a draft you are typing
  10. Kites
  11. 5
  12. use it on any device
  13. Maths
  14. False
  15. Science
  16. 6
  17. Art
  18. 0
  19. your last game level
  20. 5
  21. Music
  22. 8
  23. 6
  24. chat messages to friends
  25. True
  26. True
  27. 2
  28. 3
  29. True
  30. Aman
  31. 3
  32. 3
  33. 7
  34. True
  35. Kites
  36. 3
  37. Hindi
  38. on the phone
  39. a named box for a value
  40. Aman

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