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

Answer key

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

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