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

Answer key

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

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