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

Answer key

  1. photos on two devices
  2. 5
  3. 10
  4. True
  5. False
  6. 4
  7. on the phone
  8. 8
  9. 8
  10. on the phone
  11. False
  12. the sound on/off setting
  13. 0
  14. 5
  15. on the phone
  16. Maths
  17. Ocean
  18. Sunrise
  19. True
  20. False
  21. data saved on the phone
  22. use it on any device
  23. Sports
  24. True
  25. True
  26. in the cloud
  27. 3
  28. 7
  29. a shared to-do list
  30. Stars
  31. True
  32. 1
  33. a list
  34. 8
  35. Stars
  36. Hindi
  37. the phone is lost
  38. chat messages to friends
  39. Hindi
  40. Kabir

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