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

Answer key

  1. Science
  2. False
  3. 4
  4. 6
  5. 5
  6. False
  7. on the phone
  8. a named box for a value
  9. 6
  10. 5
  11. 0
  12. a list
  13. 10
  14. data saved on the phone
  15. a draft you are typing
  16. on the phone
  17. your last game level
  18. 1
  19. Rain
  20. Kites
  21. notes to read offline
  22. 5
  23. on the phone
  24. 5
  25. 10
  26. in the cloud
  27. Maths
  28. False
  29. 4
  30. Kabir
  31. 5
  32. 5
  33. Music
  34. Kabir
  35. Monsoon
  36. 6
  37. 7
  38. Arjun
  39. Monsoon
  40. False

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