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

Answer key

  1. photos on two devices
  2. in the cloud
  3. Riya
  4. in the cloud
  5. 4
  6. a named box for a value
  7. Arjun
  8. Sports
  9. True
  10. Music
  11. Maths
  12. Kites
  13. 5
  14. the phone is lost
  15. False
  16. Rain
  17. Arjun
  18. 0
  19. False
  20. 6
  21. 5
  22. Zoya
  23. False
  24. 4
  25. on the phone
  26. a shared to-do list
  27. Stars
  28. 3
  29. Sunrise
  30. on the phone
  31. 4
  32. True
  33. Art
  34. Hindi
  35. False
  36. a list
  37. Riya
  38. 4
  39. chat messages to friends
  40. Maths

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