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

Answer key

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

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