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

Answer key

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

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