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

Answer key

  1. 4
  2. on the phone
  3. notes to read offline
  4. the phone is lost
  5. Science
  6. False
  7. True
  8. 4
  9. in the cloud
  10. a list
  11. Maths
  12. True
  13. Maths
  14. 6
  15. Meera
  16. Stars
  17. on the phone
  18. True
  19. Science
  20. Kites
  21. Monsoon
  22. on the phone
  23. 5
  24. False
  25. a draft you are typing
  26. 2
  27. Maths
  28. 6
  29. in the cloud
  30. Sports
  31. True
  32. 4
  33. 3
  34. 6
  35. Ocean
  36. 6
  37. Ocean
  38. Stars
  39. 7
  40. Arjun

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