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

Answer key

  1. 5
  2. Zoya
  3. Zoya
  4. 5
  5. Arjun
  6. True
  7. 4
  8. photos on two devices
  9. chat messages to friends
  10. data saved on the phone
  11. False
  12. 5
  13. a draft you are typing
  14. the sound on/off setting
  15. Science
  16. on the phone
  17. a list
  18. Arjun
  19. 9
  20. False
  21. 6
  22. a class leaderboard
  23. Stars
  24. True
  25. Monsoon
  26. your last game level
  27. 7
  28. Hindi
  29. Hindi
  30. Sports
  31. on the phone
  32. Aman
  33. the phone is lost
  34. Kites
  35. 0
  36. True
  37. 3
  38. 8
  39. in the cloud
  40. on the phone

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