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

Answer key

  1. 6
  2. Hindi
  3. 3
  4. on the phone
  5. a shared to-do list
  6. 5
  7. False
  8. use it on any device
  9. in the cloud
  10. 4
  11. chat messages to friends
  12. in the cloud
  13. True
  14. 2
  15. 3
  16. Sunrise
  17. 5
  18. 4
  19. 4
  20. Music
  21. notes to read offline
  22. a class leaderboard
  23. your last game level
  24. True
  25. on the phone
  26. False
  27. a named box for a value
  28. 12
  29. the phone is lost
  30. Rain
  31. 3
  32. False
  33. the sound on/off setting
  34. Rain
  35. 3
  36. 4
  37. 4
  38. Art
  39. 4
  40. 0

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