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

Answer key

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

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