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

Answer key

  1. a named box for a value
  2. 7
  3. the sound on/off setting
  4. Arjun
  5. Rain
  6. on the phone
  7. 5
  8. Kabir
  9. Kites
  10. use it on any device
  11. 5
  12. False
  13. 11
  14. in the cloud
  15. Sunrise
  16. a draft you are typing
  17. False
  18. photos on two devices
  19. True
  20. True
  21. 4
  22. 6
  23. Arjun
  24. True
  25. Rain
  26. in the cloud
  27. 5
  28. Sports
  29. Maths
  30. Kabir
  31. a class leaderboard
  32. 0
  33. Monsoon
  34. the phone is lost
  35. a list
  36. on the phone
  37. 3
  38. a shared to-do list
  39. 5
  40. 8

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