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

Answer key

  1. a list
  2. a class leaderboard
  3. photos on two devices
  4. False
  5. 0
  6. on the phone
  7. 6
  8. Sports
  9. 7
  10. Kites
  11. True
  12. chat messages to friends
  13. 5
  14. 6
  15. a draft you are typing
  16. Arjun
  17. Maths
  18. on the phone
  19. Kabir
  20. a shared to-do list
  21. True
  22. 2
  23. True
  24. 4
  25. use it on any device
  26. 4
  27. 5
  28. Monsoon
  29. True
  30. 5
  31. 4
  32. Music
  33. Zoya
  34. 5
  35. notes to read offline
  36. Stars
  37. Art
  38. the phone is lost
  39. False
  40. a named box for a value

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