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

Answer key

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

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