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

Answer key

  1. 6
  2. 4
  3. Rain
  4. 5
  5. 2
  6. chat messages to friends
  7. a class leaderboard
  8. in the cloud
  9. on the phone
  10. 3
  11. Arjun
  12. a named box for a value
  13. 3
  14. True
  15. data saved on the phone
  16. in the cloud
  17. your last game level
  18. True
  19. Meera
  20. 9
  21. the sound on/off setting
  22. 5
  23. False
  24. 3
  25. Hindi
  26. True
  27. a list
  28. 9
  29. 8
  30. Monsoon
  31. 9
  32. 4
  33. photos on two devices
  34. 1
  35. in the cloud
  36. 4
  37. 5
  38. 4
  39. 3
  40. the phone is lost

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