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

Answer key

  1. Art
  2. on the phone
  3. False
  4. data saved on the phone
  5. on the phone
  6. True
  7. a named box for a value
  8. use it on any device
  9. in the cloud
  10. 4
  11. True
  12. on the phone
  13. in the cloud
  14. chat messages to friends
  15. Aman
  16. 5
  17. a list
  18. a shared to-do list
  19. 4
  20. the phone is lost
  21. Hindi
  22. 4
  23. 7
  24. Maths
  25. False
  26. Sports
  27. 4
  28. Rain
  29. 4
  30. 6
  31. 4
  32. Art
  33. 5
  34. 0
  35. Stars
  36. False
  37. 2
  38. Arjun
  39. 7
  40. 4

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