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

Answer key

  1. 3
  2. False
  3. 5
  4. 4
  5. False
  6. notes to read offline
  7. in the cloud
  8. Sunrise
  9. the phone is lost
  10. on the phone
  11. 5
  12. 4
  13. 0
  14. True
  15. a class leaderboard
  16. 3
  17. Zoya
  18. 1
  19. in the cloud
  20. Aman
  21. use it on any device
  22. in the cloud
  23. 6
  24. Science
  25. Science
  26. 5
  27. Stars
  28. Art
  29. on the phone
  30. False
  31. 8
  32. 3
  33. True
  34. False
  35. a draft you are typing
  36. Zoya
  37. Sunrise
  38. Science
  39. your last game level
  40. chat messages to friends

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