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

Answer key

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

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