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

Answer key

  1. data saved on the phone
  2. 0
  3. 5
  4. in the cloud
  5. 7
  6. use it on any device
  7. a named box for a value
  8. 5
  9. on the phone
  10. a class leaderboard
  11. a list
  12. 6
  13. in the cloud
  14. chat messages to friends
  15. 3
  16. Art
  17. the phone is lost
  18. Stars
  19. 4
  20. 4
  21. Meera
  22. in the cloud
  23. False
  24. True
  25. Zoya
  26. 5
  27. photos on two devices
  28. False
  29. on the phone
  30. a draft you are typing
  31. 4
  32. 6
  33. False
  34. 10
  35. Arjun
  36. False
  37. True
  38. 5
  39. 7
  40. 12

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