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

Answer key

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

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