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

Answer key

  1. Art
  2. Monsoon
  3. True
  4. 4
  5. 6
  6. Kites
  7. Riya
  8. 0
  9. the sound on/off setting
  10. 4
  11. True
  12. False
  13. False
  14. a list
  15. Monsoon
  16. use it on any device
  17. Meera
  18. on the phone
  19. 5
  20. a named box for a value
  21. False
  22. 3
  23. Hindi
  24. Hindi
  25. Arjun
  26. Science
  27. 2
  28. 1
  29. False
  30. a draft you are typing
  31. your last game level
  32. 7
  33. a shared to-do list
  34. False
  35. 3
  36. data saved on the phone
  37. Kabir
  38. Sports
  39. Sports
  40. 12

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