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

Answer key

  1. data saved on the phone
  2. a shared to-do list
  3. on the phone
  4. your last game level
  5. Hindi
  6. 7
  7. 3
  8. True
  9. a named box for a value
  10. Sports
  11. 6
  12. on the phone
  13. 0
  14. photos on two devices
  15. in the cloud
  16. Zoya
  17. 5
  18. True
  19. 6
  20. Ocean
  21. use it on any device
  22. 6
  23. in the cloud
  24. the phone is lost
  25. in the cloud
  26. Zoya
  27. 6
  28. True
  29. 5
  30. 5
  31. the sound on/off setting
  32. 3
  33. Riya
  34. on the phone
  35. False
  36. 5
  37. 3
  38. 5
  39. Hindi
  40. 6

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