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

Answer key

  1. 11
  2. Stars
  3. a named box for a value
  4. data saved on the phone
  5. False
  6. in the cloud
  7. False
  8. on the phone
  9. True
  10. 2
  11. a class leaderboard
  12. Kabir
  13. Ocean
  14. a list
  15. Riya
  16. on the phone
  17. 7
  18. 5
  19. 6
  20. your last game level
  21. Sunrise
  22. Aman
  23. Music
  24. in the cloud
  25. Ocean
  26. 8
  27. photos on two devices
  28. False
  29. True
  30. Arjun
  31. on the phone
  32. Art
  33. 10
  34. 4
  35. 8
  36. 5
  37. False
  38. Maths
  39. 11
  40. on the phone

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