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

Answer key

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

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