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

Answer key

  1. the phone is lost
  2. a draft you are typing
  3. False
  4. 6
  5. 6
  6. a class leaderboard
  7. in the cloud
  8. the sound on/off setting
  9. 6
  10. 5
  11. 11
  12. Maths
  13. chat messages to friends
  14. a named box for a value
  15. True
  16. True
  17. Science
  18. a list
  19. 5
  20. Hindi
  21. Science
  22. 5
  23. 4
  24. True
  25. data saved on the phone
  26. Science
  27. on the phone
  28. Meera
  29. False
  30. on the phone
  31. Rain
  32. 3
  33. Maths
  34. Monsoon
  35. 0
  36. 3
  37. Art
  38. Music
  39. 6
  40. 3

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