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

Answer key

  1. Stars
  2. use it on any device
  3. a shared to-do list
  4. 5
  5. a named box for a value
  6. on the phone
  7. a list
  8. True
  9. 5
  10. Kabir
  11. Arjun
  12. True
  13. your last game level
  14. False
  15. 3
  16. photos on two devices
  17. 3
  18. Ocean
  19. in the cloud
  20. 5
  21. Hindi
  22. 4
  23. False
  24. 3
  25. True
  26. False
  27. Art
  28. the phone is lost
  29. in the cloud
  30. data saved on the phone
  31. in the cloud
  32. 2
  33. 9
  34. Art
  35. True
  36. Monsoon
  37. Stars
  38. 6
  39. in the cloud
  40. 6

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