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

Answer key

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

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