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

Answer key

  1. 4
  2. the phone is lost
  3. Arjun
  4. 4
  5. a list
  6. 3
  7. Meera
  8. Maths
  9. notes to read offline
  10. the sound on/off setting
  11. 5
  12. your last game level
  13. Maths
  14. 4
  15. True
  16. on the phone
  17. on the phone
  18. 3
  19. in the cloud
  20. True
  21. Science
  22. Zoya
  23. a named box for a value
  24. in the cloud
  25. use it on any device
  26. 12
  27. 3
  28. Kites
  29. False
  30. 9
  31. False
  32. in the cloud
  33. Riya
  34. on the phone
  35. 3
  36. 3
  37. on the phone
  38. Sunrise
  39. chat messages to friends
  40. 4

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