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

Answer key

  1. Riya
  2. 7
  3. 3
  4. True
  5. on the phone
  6. in the cloud
  7. notes to read offline
  8. Riya
  9. Hindi
  10. on the phone
  11. 0
  12. data saved on the phone
  13. 7
  14. False
  15. True
  16. 5
  17. True
  18. 4
  19. Rain
  20. a draft you are typing
  21. Riya
  22. the sound on/off setting
  23. 5
  24. 5
  25. 4
  26. in the cloud
  27. use it on any device
  28. on the phone
  29. Hindi
  30. a named box for a value
  31. Hindi
  32. Aman
  33. 3
  34. in the cloud
  35. Maths
  36. 2
  37. Zoya
  38. 4
  39. 7
  40. Meera

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