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

Answer key

  1. 4
  2. in the cloud
  3. Ocean
  4. True
  5. 8
  6. on the phone
  7. a list
  8. Science
  9. Arjun
  10. 6
  11. 3
  12. Stars
  13. on the phone
  14. Zoya
  15. Sports
  16. use it on any device
  17. Stars
  18. the sound on/off setting
  19. False
  20. data saved on the phone
  21. 4
  22. chat messages to friends
  23. False
  24. 0
  25. 9
  26. 5
  27. Music
  28. Music
  29. 6
  30. a class leaderboard
  31. in the cloud
  32. Music
  33. in the cloud
  34. 3
  35. a named box for a value
  36. True
  37. False
  38. True
  39. 3
  40. Stars

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