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

Answer key

  1. 0
  2. Sports
  3. a draft you are typing
  4. 4
  5. 6
  6. 4
  7. in the cloud
  8. 4
  9. on the phone
  10. 4
  11. False
  12. Music
  13. True
  14. in the cloud
  15. 5
  16. a shared to-do list
  17. True
  18. a list
  19. False
  20. 10
  21. Art
  22. on the phone
  23. 4
  24. the sound on/off setting
  25. a class leaderboard
  26. on the phone
  27. False
  28. True
  29. in the cloud
  30. Maths
  31. 4
  32. 4
  33. 3
  34. Music
  35. chat messages to friends
  36. on the phone
  37. 4
  38. Art
  39. Science
  40. 6

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