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

Answer key

  1. on the phone
  2. the phone is lost
  3. a named box for a value
  4. in the cloud
  5. 7
  6. True
  7. notes to read offline
  8. 5
  9. on the phone
  10. Meera
  11. on the phone
  12. 5
  13. False
  14. in the cloud
  15. 5
  16. Art
  17. Rain
  18. 10
  19. a class leaderboard
  20. on the phone
  21. 4
  22. Music
  23. Rain
  24. your last game level
  25. Kites
  26. data saved on the phone
  27. 3
  28. True
  29. True
  30. 4
  31. 4
  32. Art
  33. 6
  34. 5
  35. 6
  36. 4
  37. True
  38. Rain
  39. 6
  40. 5

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