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

Answer key

  1. photos on two devices
  2. a list
  3. 2
  4. a draft you are typing
  5. use it on any device
  6. on the phone
  7. Arjun
  8. 7
  9. on the phone
  10. in the cloud
  11. 4
  12. Science
  13. Hindi
  14. on the phone
  15. False
  16. 8
  17. the phone is lost
  18. on the phone
  19. 8
  20. 3
  21. in the cloud
  22. 5
  23. False
  24. in the cloud
  25. 8
  26. 9
  27. the sound on/off setting
  28. a named box for a value
  29. a class leaderboard
  30. True
  31. notes to read offline
  32. 4
  33. Art
  34. True
  35. Kabir
  36. 3
  37. 7
  38. 5
  39. Hindi
  40. Riya

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