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

Answer key

  1. 5
  2. the phone is lost
  3. Kabir
  4. a named box for a value
  5. True
  6. on the phone
  7. Aman
  8. use it on any device
  9. 6
  10. Monsoon
  11. a draft you are typing
  12. Maths
  13. Art
  14. 4
  15. Riya
  16. Aman
  17. Stars
  18. data saved on the phone
  19. a list
  20. False
  21. 4
  22. True
  23. on the phone
  24. a class leaderboard
  25. Monsoon
  26. Hindi
  27. Sunrise
  28. False
  29. True
  30. in the cloud
  31. Kites
  32. chat messages to friends
  33. False
  34. Kabir
  35. True
  36. False
  37. Sports
  38. True
  39. Hindi
  40. Science

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