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

Answer key

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

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