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

Answer key

  1. True
  2. 0
  3. the phone is lost
  4. a shared to-do list
  5. False
  6. 4
  7. True
  8. a list
  9. Kites
  10. 4
  11. on the phone
  12. Sports
  13. 10
  14. 1
  15. False
  16. photos on two devices
  17. 5
  18. 7
  19. True
  20. 11
  21. Kabir
  22. data saved on the phone
  23. False
  24. on the phone
  25. a draft you are typing
  26. in the cloud
  27. Art
  28. Ocean
  29. 2
  30. on the phone
  31. a named box for a value
  32. 3
  33. 8
  34. 7
  35. in the cloud
  36. 5
  37. 7
  38. 4
  39. 3
  40. 4

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