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

Answer key

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

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