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

Answer key

  1. notes to read offline
  2. Ocean
  3. a class leaderboard
  4. in the cloud
  5. chat messages to friends
  6. data saved on the phone
  7. False
  8. on the phone
  9. Maths
  10. 4
  11. False
  12. in the cloud
  13. a draft you are typing
  14. 7
  15. 4
  16. 5
  17. Hindi
  18. 5
  19. True
  20. 2
  21. 4
  22. Rain
  23. Meera
  24. 7
  25. 4
  26. a shared to-do list
  27. 6
  28. False
  29. 7
  30. Music
  31. True
  32. Maths
  33. Kites
  34. 1
  35. Sports
  36. Sports
  37. 3
  38. False
  39. photos on two devices
  40. Aman

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