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

Answer key

  1. Aman
  2. chat messages to friends
  3. 4
  4. on the phone
  5. 8
  6. Sunrise
  7. Sports
  8. Sunrise
  9. False
  10. 6
  11. True
  12. True
  13. on the phone
  14. 8
  15. a named box for a value
  16. 5
  17. in the cloud
  18. data saved on the phone
  19. 6
  20. Maths
  21. a list
  22. 6
  23. 6
  24. in the cloud
  25. Art
  26. Music
  27. a draft you are typing
  28. 6
  29. your last game level
  30. 4
  31. False
  32. a shared to-do list
  33. 4
  34. False
  35. Sports
  36. the phone is lost
  37. True
  38. 5
  39. Science
  40. on the phone

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