Docsity

64 Solved MCQs on Object Oriented Programming - Exam 1 | COP 3330, Exams of Computer Science

Toggle sidebar
bg1
University of Central Florida
COP 3330 Object Oriented Programming
Exam 1-1
1. Operators are special symbols that perform specific operations on up to
how many operands?
a. One
b. Two
c. Three
d. Four
e. None
2. Regarding operator precedence which of the following would be
evaluated first?
a. =
b. *
c. +
d. instanceof
e. ++
3. What is the purpose of the assignment operator?
a. Assigns the value on the left to the operand on the right
b. Assigns the value on the right to the operand on the left
c. To check for equality
d. To check for identical
e. None of the above
4. The + operator performs two operations, which of the following is true?
a. Assignment
b. Concatenation
c. Addition
d. A and C
e. B and C
5. How many operands do unary operators require?
a. One
b. Two
c. Three
d. Four
e. None
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download 64 Solved MCQs on Object Oriented Programming - Exam 1 | COP 3330 and more Exams Computer Science in PDF only on Docsity!

University of Central Florida

COP 3330 Object Oriented Programming

Exam 1-

  1. Operators are special symbols that perform specific operations on up to how many operands? a. One b. Two c. Three d. Four e. None
  2. Regarding operator precedence which of the following would be evaluated first? a. = b. * c. + d. instanceof e. ++
  3. What is the purpose of the assignment operator? a. Assigns the value on the left to the operand on the right b. Assigns the value on the right to the operand on the left c. To check for equality d. To check for identical e. None of the above
  4. The + operator performs two operations, which of the following is true? a. Assignment b. Concatenation c. Addition d. A and C e. B and C
  5. How many operands do unary operators require? a. One b. Two c. Three d. Four e. None
  1. Regarding conditional operators (i.e. &&, ||) what does “short circuiting” behavior mean? a. Both operands/expressions are evaluated b. Only the second operand/expression is evaluated c. Only the first operand/expression is evaluated d. The second operand/expression is evaluated if needed e. None of the operands/expressions are evaluated
  2. What does the instanceof operator do? a. Tests if the compared operands are equal b. Tests if the compared operands are identical c. Tests if the expression is true d. Tests if the expression is false e. Tests if the object is an instance of a class, subclass, or implements an interface
  3. A programmer should always close any input or output stream when done accessing the resource a. True b. False c. It depends
  4. A(n) ________ comprises variables, operators, and method invocations. a. Expression b. Statement c. Abstract class d. Class e. Interface
  5. A(n) ________ forms a complete unit of execution to include a terminating semicolon. a. Expression b. Expression statement c. Abstract class d. Class e. Interface
  6. A(n) ________ declares a variable. a. Expression b. Expression statement c. Declaration statement d. Class e. Interface
  7. What is used in programming to block a group of zero or more executable statements?

c. A class is defined d. An interface is defined e. An abstract class is defined

  1. Parameters are different than arguments because arguments are used when __________. a. A method or constructor is defined b. A method or constructor is called c. A class is defined d. An interface is defined e. An abstract class is defined
  2. Variable naming has rules associated with it. Which of the following is true? a. They can start with a number b. They can start with any special character c. They can include white space d. All of the above e. None of the above
  3. In object-oriented terms what is used as a blueprint to model a real- world object? a. Method b. State c. Behavior d. Constant e. Class
  4. Object-oriented programming allows for inheritance so commonly used state and behavior can be reused. The class that is inherited from is the __________ and the new class is the __________. a. Superclass, subclass b. Subclass, superclass c. Interface, subclass d. Class, package e. Extends, implements
  5. How many superclasses can a subclass extend when using inheritance in object-oriented programming using the Java programming language? a. Zero b. One c. Two d. Three e. Unlimited
  6. When using inheritance what does the new class inherit when it is derived from another class? a. State, behavior b. Object, class c. Inheritance, interface
  1. When implementing an interface in object-oriented programming all __________ must be included in the source code for the class to compile. a. State b. State and behavior c. Superclasses d. Constructors e. Methods
  2. An expression statement forms a complete unit of execution with a terminating semicolon. The following code is a correct example of an expression statement: Game game = new Game(); a. True b. False
  3. Does the following code include all required components for a class declaration? public class NewClass { } a. Yes b. No, it’s missing the fields and methods c. No, the access modifier is not required d. No, it’s missing the return type e. No, it’s missing the parentheses and parameter list
  4. What are the components of a method declaration that comprise the method signature? a. Method return type and method name b. Method return type and method parameter list c. Method return type, method name, and method parameter list d. Method name and method parameter list e. All of the above
  5. Does the following code include all required components for a method declaration? void thisMethod() { } a. Yes b. No, it’s missing the access modifier c. No, it’s missing the return type d. No, it’s missing the parameter list e. No it’s missing the argument list
  1. Which of the following are types of class member variables? a. Fields b. Local variables c. Parameters d. All of the above e. None of the above
  2. The object-oriented concept of software reuse allows a class to be created once and used __________. a. Never b. Once unless it is extended using inheritance c. As many times as desired to include extending it using inheritance d. Ten times or less e. Once unless it is implemented using interface
  3. If a class explicitly declares a constructor that takes 0…n parameters when instantiated what happens to the default constructor of the class? a. It still exists and can be used to create instances of the class b. It is automatically created by the Java compiler c. It no longer exists d. All of the above e. None of the above
  4. A class that is declared final can be extended or subclassed. a. True b. False
  5. When does a method return to the code that invoked it? a. Completes all the statements in the method b. Reaches a return statement c. Throws an exception d. A or B e. A, B, or C
  6. Classes that cannot have objects created from them are called what? a. Abstract b. Concrete c. Interfaces d. Inheritance e. Polymorphism
  7. An abstract method is a method that is: a. Declared without implementation b. Has no curly braces c. Ends with a semicolon
  1. A subclass of an abstract class must provide _________ for all abstract methods of the superclass to be considered a concrete class. a. Interfaces b. Implementation c. Guidance d. Comments e. Shadowing
  2. What is the automatic access modifier of methods and fields of interfaces? a. Package b. Public c. Package-private d. Private e. Protected
  3. What does the keyword final indicated regarding methods or field members of a class? a. They cannot be modified b. They are public c. They are private d. They are modifiable e. None of the above
  4. If there are an unknown number of parameters being passed to a method a software developer can use a construct called __________. a. varargs b. an array c. an ArrayList d. a 2-d array e. None of the above
  5. The ternary operator takes three operands and uses the (?:) notation. What control structure does the ternary operator mimic? a. If/else b. While loop c. Switch d. For loop e. Do/while loop
  6. Regarding object-oriented programming, declaration means that a variable name is associated with an object type and creates an object of that type. a. True b. False
  1. When method parameters have the same name as class fields this is called __________. a. Repetition b. Duplication c. Same name d. Shadowing e. Confusion
  2. When having to programmatically differentiate a parameter having the same name as a field of a class what keyword can resolve this issue with the compiler when setting the field value equal to the argument value passed into the method? a. keyword b. this c. parameter d. argument e. in
  3. Regarding object-oriented programming, when an object is instantiated the keyword new is used, memory is allocated, and a reference to that memory is returned. a. True b. False
  4. An interface can and should be instantiated. a. True b. False
  5. How are primitive and reference data arguments pass into a method? a. By reference b. By physical location c. By value d. By object location e. None of the above
  6. A method in object oriented programming can return primitive data types, __________, or __________. a. Project, package b. Function, method c. Constructor, exception d. Class, interface e. Code, return
  7. The keyword this is used to reference __________. a. The inheritance b. The interface
  1. Interfaces and abstract classes can have objects instantiated from them. a. True b. False
  2. Operators with higher precedence are evaluated __________ operators with relatively __________ precedence a. After, lower b. Before, higher c. Before, lower d. After, higher e. None of the above
  3. When defining classes in the Java programming language a software developer can extend __________ superclasses and implement __________ interfaces. a. Unlimited, one b. Two, unlimited c. One, unlimited d. Unlimited, two e. Unlimited, unlimited
  4. A class that uses an explicit constructor invocation uses the keyword this to __________. a. Call another constructor in the same class b. Call the super constructor c. User recursion and call itself d. Call another constructor in a different class e. Call the constructor of the implemented interface
  5. When a method has a return type other than void what data type can be returned from that method? a. No return value is required b. The returned data type can be any data type valid in the Java programming language c. The returned data type must match the declared return data type d. The returned data type should be String e. None of the above
  6. Access level modifiers do not define how other classes can reference a field or invoke a method. a. True b. False
  1. What allows for methods to have the same name but different method signatures in object oriented programming? a. Class overriding b. Method overriding c. Class overloading d. Method overloading e. Shadowing
  1. Entomophagy is the practice of eating insects and bugs. Which is the world’s tastiest insect? a. Nigeria’s crickets b. China’s earthworm soup c. Macao’s fried beetles d. Brazil’s stingless bees and wasps e. I would eat them all!