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

Answer key

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

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