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

Answer key

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

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