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

Answer key

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

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