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

Answer key

  1. 6
  2. 6
  3. 7
  4. Kites
  5. a named box for a value
  6. in the cloud
  7. True
  8. True
  9. Art
  10. False
  11. chat messages to friends
  12. 6
  13. data saved on the phone
  14. on the phone
  15. a class leaderboard
  16. the sound on/off setting
  17. 3
  18. 0
  19. Stars
  20. 3
  21. on the phone
  22. False
  23. Aman
  24. Science
  25. 5
  26. in the cloud
  27. Sports
  28. Hindi
  29. notes to read offline
  30. 5
  31. 5
  32. 4
  33. your last game level
  34. 3
  35. in the cloud
  36. 6
  37. in the cloud
  38. 3
  39. 4
  40. 10

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