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

Answer key

  1. 5
  2. False
  3. notes to read offline
  4. 4
  5. a shared to-do list
  6. the phone is lost
  7. a list
  8. True
  9. data saved on the phone
  10. Arjun
  11. Kites
  12. 2
  13. Riya
  14. Hindi
  15. 8
  16. True
  17. 5
  18. your last game level
  19. False
  20. True
  21. on the phone
  22. False
  23. 5
  24. 6
  25. Art
  26. 5
  27. 3
  28. Kabir
  29. 7
  30. Meera
  31. the sound on/off setting
  32. on the phone
  33. False
  34. on the phone
  35. 4
  36. 6
  37. True
  38. 10
  39. 0
  40. in the cloud

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