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

Answer key

  1. Stars
  2. 7
  3. Aman
  4. use it on any device
  5. in the cloud
  6. chat messages to friends
  7. the phone is lost
  8. 7
  9. 2
  10. False
  11. Zoya
  12. Maths
  13. Sports
  14. Kites
  15. True
  16. 4
  17. on the phone
  18. 1
  19. Aman
  20. data saved on the phone
  21. Sunrise
  22. Meera
  23. Rain
  24. 0
  25. 3
  26. a list
  27. 4
  28. 5
  29. Rain
  30. Sunrise
  31. the sound on/off setting
  32. on the phone
  33. Maths
  34. 5
  35. False
  36. 5
  37. Zoya
  38. 2
  39. on the phone
  40. a class leaderboard

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