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

Answer key

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

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