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

Answer key

  1. a named box for a value
  2. 2
  3. Stars
  4. Music
  5. Maths
  6. 4
  7. a draft you are typing
  8. the phone is lost
  9. notes to read offline
  10. 3
  11. Stars
  12. 0
  13. 5
  14. a list
  15. in the cloud
  16. 7
  17. Maths
  18. on the phone
  19. a class leaderboard
  20. on the phone
  21. data saved on the phone
  22. True
  23. Sports
  24. False
  25. in the cloud
  26. a shared to-do list
  27. True
  28. 5
  29. False
  30. 3
  31. Aman
  32. chat messages to friends
  33. 6
  34. Arjun
  35. on the phone
  36. 3
  37. 5
  38. Rain
  39. 4
  40. 4

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