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

Answer key

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

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