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

Answer key

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

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