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

Answer key

  1. True
  2. 5
  3. Kites
  4. in the cloud
  5. 4
  6. your last game level
  7. on the phone
  8. Music
  9. in the cloud
  10. 5
  11. Kabir
  12. 5
  13. data saved on the phone
  14. 3
  15. in the cloud
  16. on the phone
  17. the sound on/off setting
  18. a draft you are typing
  19. 7
  20. Art
  21. 3
  22. 0
  23. on the phone
  24. Art
  25. 3
  26. chat messages to friends
  27. Art
  28. Aman
  29. True
  30. notes to read offline
  31. a list
  32. Maths
  33. 5
  34. 4
  35. False
  36. 2
  37. 6
  38. the phone is lost
  39. 4
  40. False

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