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

Answer key

  1. a named box for a value
  2. 5
  3. on the phone
  4. 7
  5. photos on two devices
  6. Riya
  7. Sports
  8. False
  9. data saved on the phone
  10. Science
  11. a class leaderboard
  12. 4
  13. Aman
  14. Arjun
  15. the phone is lost
  16. 5
  17. Maths
  18. on the phone
  19. 5
  20. on the phone
  21. 4
  22. False
  23. 5
  24. True
  25. 4
  26. a shared to-do list
  27. on the phone
  28. Arjun
  29. 4
  30. 0
  31. 5
  32. Kites
  33. in the cloud
  34. False
  35. notes to read offline
  36. Zoya
  37. False
  38. 4
  39. a draft you are typing
  40. a list

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