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

Answer key

  1. Rain
  2. a class leaderboard
  3. a named box for a value
  4. Science
  5. data saved on the phone
  6. in the cloud
  7. use it on any device
  8. 3
  9. Sunrise
  10. 6
  11. the phone is lost
  12. 5
  13. 3
  14. Kabir
  15. 4
  16. photos on two devices
  17. on the phone
  18. 3
  19. 4
  20. a list
  21. in the cloud
  22. 5
  23. 5
  24. Sunrise
  25. 4
  26. 5
  27. the sound on/off setting
  28. True
  29. True
  30. 4
  31. on the phone
  32. in the cloud
  33. 0
  34. Stars
  35. 5
  36. Music
  37. True
  38. True
  39. Art
  40. Science

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