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

Answer key

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

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