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

Answer key

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

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