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

Answer key

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

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