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

Answer key

  1. Kites
  2. 3
  3. True
  4. a named box for a value
  5. in the cloud
  6. on the phone
  7. in the cloud
  8. 11
  9. Stars
  10. 0
  11. use it on any device
  12. on the phone
  13. 5
  14. data saved on the phone
  15. 8
  16. 6
  17. 6
  18. photos on two devices
  19. a class leaderboard
  20. Arjun
  21. 6
  22. True
  23. a list
  24. 5
  25. 6
  26. your last game level
  27. Stars
  28. 6
  29. Science
  30. a draft you are typing
  31. 2
  32. chat messages to friends
  33. 5
  34. Sports
  35. Science
  36. 3
  37. Arjun
  38. False
  39. Riya
  40. notes to read offline

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