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

Answer key

  1. 5
  2. notes to read offline
  3. a list
  4. 8
  5. 5
  6. the phone is lost
  7. 4
  8. the sound on/off setting
  9. in the cloud
  10. 6
  11. on the phone
  12. on the phone
  13. Stars
  14. False
  15. a draft you are typing
  16. 4
  17. Kites
  18. 5
  19. 5
  20. 9
  21. in the cloud
  22. True
  23. 5
  24. Meera
  25. 0
  26. Maths
  27. True
  28. Art
  29. False
  30. Art
  31. a shared to-do list
  32. in the cloud
  33. 5
  34. True
  35. Arjun
  36. 4
  37. False
  38. a class leaderboard
  39. on the phone
  40. Arjun

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