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

Answer key

  1. photos on two devices
  2. True
  3. a named box for a value
  4. a shared to-do list
  5. use it on any device
  6. in the cloud
  7. 4
  8. 4
  9. Ocean
  10. True
  11. 5
  12. True
  13. on the phone
  14. a list
  15. the phone is lost
  16. Music
  17. False
  18. 2
  19. True
  20. 3
  21. 0
  22. the sound on/off setting
  23. in the cloud
  24. 4
  25. 8
  26. a draft you are typing
  27. False
  28. data saved on the phone
  29. Art
  30. Art
  31. 8
  32. on the phone
  33. 8
  34. 3
  35. Kabir
  36. Riya
  37. Maths
  38. 4
  39. Aman
  40. 6

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