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

Answer key

  1. 3
  2. on the phone
  3. 4
  4. notes to read offline
  5. a class leaderboard
  6. Ocean
  7. 9
  8. on the phone
  9. Zoya
  10. False
  11. your last game level
  12. a draft you are typing
  13. a named box for a value
  14. Arjun
  15. in the cloud
  16. in the cloud
  17. 0
  18. chat messages to friends
  19. Maths
  20. True
  21. the sound on/off setting
  22. data saved on the phone
  23. Zoya
  24. Monsoon
  25. Arjun
  26. Music
  27. Art
  28. True
  29. 4
  30. a shared to-do list
  31. 6
  32. Art
  33. 4
  34. 4
  35. photos on two devices
  36. on the phone
  37. 4
  38. 5
  39. Kites
  40. False

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