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

Answer key

  1. 5
  2. 4
  3. a list
  4. 6
  5. 1
  6. Meera
  7. True
  8. 6
  9. your last game level
  10. True
  11. False
  12. on the phone
  13. in the cloud
  14. 5
  15. Art
  16. 6
  17. use it on any device
  18. Science
  19. Kabir
  20. 3
  21. 6
  22. a class leaderboard
  23. Sports
  24. in the cloud
  25. Maths
  26. Monsoon
  27. 3
  28. Sunrise
  29. Music
  30. 4
  31. Arjun
  32. chat messages to friends
  33. on the phone
  34. Monsoon
  35. Monsoon
  36. Sunrise
  37. 3
  38. 3
  39. 0
  40. the phone is lost

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