Tri 1 Final Notes Explaniation

Notes of all the misses questions corected below

Missed Questions: 8 28 30 45

8: The procedure does not interchange the values of j and k. Rather, it returns a new list with the values at indices j and k interchanged. Video Notes: Topic is Program Design and Development How is a program developed? Programs are developed with a specific purpose in mind Developers follow specific steps and stick to their plan Sometimes the development is more exploratory than anything, and the steps are dictated by what happens Investigation is an important step in the process Developers must: Determine the requirements of the program Understand the constraints Understand the user concerns and interests How do developers investigate Surveys User testing Interviews Direct observation Developers design program by Brainstorming Storyboarding the program Planning the user experience Laying out the user interface Organizing into modules

28: This code segment incorrectly charges customers who use more than 25 units of electricity. These customers are charged $7 per unit for all units, when they should be charged this rate only for the number of units above 25. For examples, if a customer used 32 units of electricity, they should be charged $5 for the first 25 and $7 for the additional 7 units (32 – 25 = 7 units), for a total charge of $174. This code segment would incorrectly charge the customer $224 for the 32 units. Video Notes Topic: Conditionals Algorithm: a finite set of instructions that accomplish a specific task Selection: Given a parameter the algorithm uses its instructions to determine if it needs to return true or false. EX: If statements Evaluates a conditional and return true or false statement

30: Introducing a list to a program makes it more likely that the program will attempt to access an index beyond the length of the list, not less likely. Video Notes: Topic is Data Abstraction Strings An ordered sequence of characters May contain letters, numbers and all other special characters Ex: Words, phrases, sentences, ID numbers, etc. Lists An ordered sequence of elements Each element is a variable Ex: Playlists of songs, Names of students in a school, contacts in your phone, etc List Index Each element of a string is referenced by an index The index starts at 1

Essential Information A list is an ordered sequence of elements An element is an individual value in a list that is assigned a unique index An index is a common method for referencing the elements in a list or string using natural numbers A string is an ordered sequence of characters

45: The if condition (value > 0) in the for loop where count1 is updated for theList values 1,2. So the count-1 =2. The else condition of (value > 0) in the for loop where count2 is updated for theList values -2,-1,0. So the count-2 =3.

Notes of all the questions answered below

  1. Result is equal to 2 which is multiplied by 5,when the procedure is ran 3 times which displays the resulting value
  2. When the variable x is positive or 0, then Y will become False, so when it is put into the IF statement, the process will not go through because it is relayed as false instead of true
  3. All of the other answers are all benefits that would not harm the team
  4. The first two reasons, location as well as the dietary restrictions are both needed. However, the third and last reasons, the need for finding the username are not needed because in order to find other users the app finds it using the contacts of the original user
  5. Three is the only right answer because Brandon’s phone contacts is not needed in order find other restaurants that don’t have the restrictions. Past restaurants are also not needed to be known in order to find new restaurants in the area.
  6. The variable will keep getting 2 added to it until the variable is greater than the MAX variable. The first variable keeps on going even when it is equal to or less than the MAX variable.
  7. The denominator must not be 0 ever, if the denominator is zero then the equation becomes impossible to calculate. The equation becomes undefined.
  8. Newlist is making a copy of the numlist and interchanging the elements at J and K. Counting is also started at 1 instead of zero and the command LENGTH(numlist) counts all of the numbers that are available inside of the list, when counting these numbers it creates an end value which when placed back in the code cannot be passed.
  9. Score- penalty must be 0 or positive and the current commands and code do not satisfy the command and will cause it to fail. So line 7 must be changed with line 3.
  10. doing the work independently is not good for collaboration and can cause bigger failures and blocks in code writing
  11. The outer loop iterates from j = 1 to myList length-1. Assigns k = j+1. The inner loop iterates from k=j+1 to myList length. If condition compares j’th and k’th values of myList. The code segment iterates through myList, comparing each element to all subsequent elements in the list and makes containsDuplicates = true if equal.
  12. The user should not be made to put in the cost of the product, if that were true then they can pay whatever price they had wanted for the food.
  13. If the contents of myList contained [-1, 0, 1] then the procedure will not return the intended result. This is because when the code is running, it will look at the first value and return false. However, it will keep on returning the next two values as true and in the end will ultimately return true even though a negative value is present.
  14. 8 is greater than 7 so it will get passed in the first if statement, to correct this part of the code the first if statement should be replaced with >8. The second problem is that 6 is less than 7 so it goes to the else statement which makes it display a check which is wrong.
  15. The users should not be able to do much relating with the code, they can however provide different perspectives to the developers that provide new problems/ challenges which need to be overcome.
  16. When answering this question I was stuck on answer one and answer two, I had known that the messages were needed to be sent in packets so the other two answers could not be correct, however I was not sure whether or not
  17. Open protocols on the Internet helps – a way to standardize data transmission between different devices
  18. Relationship between the World Wide Web and the Internet – WWW can be considered as linked pages, programs, and files. And Internet is the Network to access WWW
  19. With 4 bits binary we can store decimal numbers from 0 to 15. Anything above decimal 15 cannot be accommodated in 4 bits – so 29 is an overflow.
  20. With 4 bits binary we can store 16 values from 0 to 15. So Four bits are enough to store the eight directions.
  21. Binary sequences are represented as 0,1s. Any information can be encoded using binary sequences.
  22. The binary sequence 0011, 0110, and 1111 represent 33, 6 and 15. 9 is missing.
  23. Analog data can be best represented in digital if we sample at regular intervals and convert into digital.
  24. Binary 1011, 1101 are 11 and 13. So increasing order is 5, 11, 12, 13
  25. Age is an integer number and not boolean, string or collection
  26. The variable isOpen has to represent true or false – hence Boolean is correct
  27. Code should be Readable and hence – variables should have meaningful names such as studentName which is String and isAbsent that is Boolean.
  28. The logic cost = numUnits(5) for less than or equals to 25 seems correct. Also for >25 is correct in C.
  29. List can grow at runtime. We can add, modify or delete elements as needed
  30. The benefit of using a list as a data abstraction in this logic is – keeping the numeric values in a list makes it easier to apply the same computation to every data element.
  31. In this myWord the element at index 3 of wordList is “ghi”. myChar the character at index 2 of myWord is “h”
  32. myList is copied to yourList
  33. Values greater than equal to 90 are printed
  34. Copied in this sequence [“guitar”, “drums”, “bass”] → firstList → thirdList → secondList
  35. The logic time > 120 makes maxPS = 30 otherwise maxPS =50 is selected
  36. Appending 2*i where i ranges from 1 to 10 – would store ten consecutive even integers, beginning with 2, in the list evenList.
  37. To swap the values in two variables num1 → temp and num2 → num1 and finally temp → num2
  38. Word2 is not changed. Word1 and word3 are swapped using a temp variable.
  39. The integer value 4 is the actual index value of a List. Other choices are not valid.
  40. The X-Y value is 3-5 =-2 is displayed as part of else condition
  41. The value 20 → q and q → p and finally p → r = 20
  42. Since num1 (6) > num2 (4) then goes to else num3 = num2 = 4. Since num2 (4) >= num3 (4) then num1 = num2 (4) + num3 (4) = 8. Finally sum = num1 (8) + num2 (4) + num3 (4) = 16
  43. This code executes for 5 times result = result + x. Where x ranges from 0 to 5. Finally result will be 15
  44. 23 mod y should be 2. The value of has to be 3.
  45. The if condition (value > 0) in the for loop where count1 is updated for theList values 1,2. So the count-1 =2. The else condition of (value > 0) in the for loop where count2 is updated for theList values -2,-1,0. So the count-2 =3.
  46. The true → first → second → first. So finally both values are true.
  47. The value 20 → x. And a = x+1 which is 21. The variable b → 20. And updated as b = x + b that makes b value to 40. The c value remains at 30. The variable c=30 and d = 40 initialized and d is updated as c+d/2 which is 50.
  48. The variable value y = 50. X is updated by y value 50. The variable z is updated by x value of 50.
  49. Initially the word = “on”. The function reverse(word) gives “no” and concat to word “on” gives “noon”
  50. The prefix(firstName, 1) gives firstName first letter and prefix(lastName, 1) gives lastName first letter value. We concat these letters to get the initials.