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

Answer key

  1. Sunrise
  2. 5
  3. 5
  4. False
  5. True
  6. on the phone
  7. Meera
  8. 6
  9. notes to read offline
  10. 6
  11. False
  12. Science
  13. Hindi
  14. 6
  15. Sports
  16. 4
  17. Hindi
  18. False
  19. data saved on the phone
  20. in the cloud
  21. a draft you are typing
  22. Sunrise
  23. 8
  24. 5
  25. False
  26. Kabir
  27. 5
  28. 5
  29. on the phone
  30. 6
  31. your last game level
  32. Art
  33. use it on any device
  34. Maths
  35. in the cloud
  36. a named box for a value
  37. 4
  38. 4
  39. 3
  40. 0

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