This topic contains a solution. Click here to go to the answer

Author Question: MC: How many comparisons will a linear search function makes before finding a match if the search ... (Read 81 times)

Caiter2013

  • Hero Member
  • *****
  • Posts: 607
MC: How many comparisons will a linear search function makes before finding a match if the search key has a value of 3 and the array x has the values: x 0  = 0 x 1  = 2 x 2  = 1 x 3  = 4 x 4  = 3 x 5  = 3
 
  (a) 3
  (b) 4
  (c) 5
  (d) 6

Question 2

What would the browser output if the following script is executed?
 
  < SCRIPT LANGUAGE = JavaScript >
  var array =   1, 2, 3 ,  1, 2, 3  ;
  for ( var i in array )
  for ( var j in array i  )
  document.write( array i  j  +   );
  document.writeln(
);
 
  < /SCRIPT >
  a) Nothing, the script would generate an error
  b) 1 2 3
  c) 1 2 3 4 5 6
  d) 1 2 3 1 2 3



Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by a Subject Expert

mirabriestensky

  • Sr. Member
  • ****
  • Posts: 325
Answer to Question 1

Ans: (c)

Answer to Question 2

Ans: (d)




Caiter2013

  • Member
  • Posts: 607
Reply 2 on: Jul 7, 2018
YES! Correct, THANKS for helping me on my review


ktidd

  • Member
  • Posts: 319
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Medication errors are more common among seriously ill patients than with those with minor conditions.

Did you know?

Never take aspirin without food because it is likely to irritate your stomach. Never give aspirin to children under age 12. Overdoses of aspirin have the potential to cause deafness.

Did you know?

Eating carrots will improve your eyesight. Carrots are high in vitamin A (retinol), which is essential for good vision. It can also be found in milk, cheese, egg yolks, and liver.

Did you know?

Before a vaccine is licensed in the USA, the Food and Drug Administration (FDA) reviews it for safety and effectiveness. The CDC then reviews all studies again, as well as the American Academy of Pediatrics and the American Academy of Family Physicians. Every lot of vaccine is tested before administration to the public, and the FDA regularly inspects vaccine manufacturers' facilities.

Did you know?

Although puberty usually occurs in the early teenage years, the world's youngest parents were two Chinese children who had their first baby when they were 8 and 9 years of age.

For a complete list of videos, visit our video library