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

Answer key

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

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