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

Answer key

  1. the sound on/off setting
  2. 4
  3. your last game level
  4. use it on any device
  5. False
  6. Ocean
  7. Sunrise
  8. Rain
  9. Monsoon
  10. on the phone
  11. 6
  12. data saved on the phone
  13. 7
  14. in the cloud
  15. Aman
  16. False
  17. 4
  18. Meera
  19. True
  20. a named box for a value
  21. 1
  22. Science
  23. 6
  24. 4
  25. False
  26. the phone is lost
  27. Monsoon
  28. 5
  29. a list
  30. chat messages to friends
  31. Hindi
  32. on the phone
  33. Hindi
  34. a class leaderboard
  35. 4
  36. 3
  37. False
  38. notes to read offline
  39. 5
  40. 5

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