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

Answer key

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

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