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

Answer key

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

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