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

Answer key

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

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