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

Answer key

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

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