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

Answer key

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

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