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

Answer key

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

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