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

Answer key

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

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