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

Answer key

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

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