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

Answer key

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

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