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

Answer key

  1. Maths
  2. 4
  3. 5
  4. on the phone
  5. False
  6. a list
  7. data saved on the phone
  8. Maths
  9. Music
  10. 0
  11. 6
  12. False
  13. 4
  14. False
  15. in the cloud
  16. Music
  17. a draft you are typing
  18. Rain
  19. on the phone
  20. a shared to-do list
  21. 6
  22. on the phone
  23. in the cloud
  24. a class leaderboard
  25. Ocean
  26. 4
  27. 6
  28. True
  29. notes to read offline
  30. Kabir
  31. 4
  32. 11
  33. Science
  34. False
  35. 5
  36. 4
  37. True
  38. Maths
  39. a named box for a value
  40. False

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