7) Which of the following situations will cause the longest execution time of a sequential search looking for a particular value in an array of 10 integers? A) The value is at position 3 in the array B) The value is at position 6 in the array C) The value is at position 9 in the array D) The value is in the middle of the array E) The value is not in the array 8) Under which of these conditions should method overloading be used? A) When you want to override the functionality of an inherited method with another one having the same name B) When the methods have different parameter names C) When the methods have similar behavior but they differ in their arity or parameter types D) Two methods with the same name will cause a compilation error 10) Which of the following is NOT TRUE about exception handling? A) Any catch statement must have some corresponding try statement. B) A finally block will only execute if no exception is thrown in the corresponding try block. C) A try block can have more than one catch block. D) You are allowed to have nested try/catch/finally blocks.
Added by Matthew S.
Step 1
This is because in a sequential search, the algorithm will have to iterate through each element of the array until it reaches the value at position 9, which is the last element. Show more…
Show all steps
Your feedback will help us improve your experience
Aarya B and 59 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Which language does not support an encapsulation construct for a single data type and its operations? a. C++ b. C# c. Java d. Ada 95 2) For the C++ class MyClass, the class destructor prototype is: a. end(); b. terminator(); c. ~MyClass(); d. dtor(); 3) Which of the following access modifiers are defined in C# but not in C++? a. private b. protected c. public d. internal 4) Which of the following languages does not support nested subprograms? a. Ada b. Java c. Python d. Ruby 5) In Java, the import statement allows references to names in a package. a. True b. False 6) C and C++ use header files for interfaces to library files. a. True b. False 7) Which of the following is not a design issue for object-oriented languages? a. Are methods required to return only objects? b. Objects exclusivity c. Single vs. multiple inheritance d. Are subclasses subtypes (e.g., derived classes)? 8) C++ supports OOP and procedure-oriented programming. a. True b. False 9) Multiple inheritance means a subclass has more than one parent class. a. True b. False 10) A Java interface is an alternative to multiple inheritance. a. True b. False
Madhur L.
If a method throws an exception and the exception is not caught inside the method: a. The program automatically crashes. b. The rest of the program is executed, but the program statement(s) that caused the problem is skipped. c. An exception is thrown. d. The method execution returns to the first line in the method. e. none of the above
1. Where the default value of parameter have to be specified? A. Function call B. Function definition C. Function prototype D. Both B or C 2. Which of the following statement is correct? A. The default value for an argument cannot be function call. B. C++ allows the redefinition of a default parameter. C. Both A and B. D. C++ does not allow the redefinition of a default parameter. 3. Which of the following statement is correct? A. Only one parameter of a function can be a default parameter. B. Minimum one parameter of a function must be a default parameter. C. All the parameters of a function can be default parameters. D. No parameter of a function can be default. 4. Which of the following statement is incorrect? A. A default argument is checked for type at the time of declaration and evaluated at the time of call. B. We can provide a default value to a particular argument in the middle of an argument list. C. We cannot provide a default value to a particular argument in the middle of an argument list. D. Default arguments are useful in situations where some arguments always have the same value. 5. Which of the following statement is correct? A. Overloaded functions can accept same number of arguments. B. Overloaded functions always return value of same data type. C. Overloaded functions can accept only same number and same type of arguments. D. Overloaded functions can accept only different number and different type of arguments.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD