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

Answer key

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

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