Primmer Exam Objective Type Questions with Answer - MCQ Village

# Primmer Exam Objective Type Questions with Answer

### 31.SPOT THE ERROR:Observe the below algorithm to find the average of threenumbers.Stepl: StartStep2: Get num1, num2, num3Step3: Add num1, num2, num3 and store it in SumStep4: Average=sum%3Step5: Display Sum and AverageStep6: StopIdentify the incorrect step(if any)

The correct answer is: Step 4

### 32.The properties of good program must have

a.Fault Prevention and fault tolerance
b. Modules tightly connected
c.Poor Design for change
d. Component dependence

### 33.Carefully read the question and answer accordingly. Which datastructure is said to be linear data structure?

a. Arrays
b. Graphs
c. Tree
d. None of the listed options

a. Sorting
b. Merging
c. Inserting
d. Traversal

### 36.What is the time complexity of these functions?int fact(int i){if(i<=1)return i;return 2*fact(i-1);}intfact2(int i){if(i<=1)return i;return fact2(i-1) + fact2(i-1);}

a. O(n) for both fact() and fact2()
b. O(2An) for both fact() and fact2()
c. O(n) for fact() and O(2An) for fact20
d. O(2An) for factO and O(n) for fact20

### 37.Which algorithm is the best sorting method in-place with noquadratic worst-case scenarios?

a. Quicksort
b. Heap Sort
c. Bubble Sort
d. Selection Sort

The correct answer is: Heap Sort

### 39.Which of the following classes are available in the java.langpackage?

(A) Stack
(B) Object
(C) Math
(D) Random
(E) String
(F) StringBuffer
(G) Vector

The correct answer is: (B), (C), (E) & (F)

### 40.Choose the method(s) of the String class

The correct answer is: intern(), replace()

### 43.Predict the output:public class Topper{public static void check() {this.display();}public static void display() {System.out.println(“Welcome to lava”);}public static void main(String args []) {}Xcheck();}

The correct answer is: Compile time error

### 44.Predict the output:interface X{void display();}interface Y extends X{void print();}class Employee implements Y{public void display() {}public void print() {}}public class TestMain {System.out.print(“John “);Employee e = new Employee();}}public static void main(String[] args) {System.out.print(“Mathew”);Select one:e.display();e.print();

The correct answer is: John Mathew

### 46.Select the true statement ?

a. Inheritance forms a is-a part of relationship between classes.
b. Aggregation forms a is-a part of relationship between classes.
Composition is the stronger form of Aggregation.
c. Aggregation is the stronger form of Inheritance.
d. Aggregation forms the is-a type of relationship between classes.

The correct answer is: Aggregation forms a is-a part of relationship between classes. Composition is the stronger form of Aggregation.

## 47.How do we change the state of an object ?

a. Using object’s property

b. Using object’s behavior
c. Using class name
d. Using Object’s default methods

a. Hierarchy
b. Encapsulation
c. Polymorphism
d. Abstraction

### 49.How does the different section of an application communicate in an OO approach ?

a. In approach, the diffferent sections run in isolation so they
will NOT interactb.

b.The objects created during runtime by different sections of the
application interact through messages
c. Different sections of the application interact through database
d. Different sections of the application interact through file system

### 50.What defines the state of an object ?

a. Using the behavior
b. Using the class Id
c. Using the class identity
d. Using the value of the class properties

### 51.order the range of coupling from high to low

a. control coupling
b. stamp coupling
c. content coupling
d. uncoupled
e. common coupling
f. data coupling

The correct answer is: c , e , a, b, f, d

a. documented
b. efficient
c. robust
d. modular

### 53.Steve is learning to draw a flowchart to calculate the volume of acuboid. Which of the options given below would fit into the processsection of the flow chart?

a. check if l,b,h have positive value
b. Read the value of I, b,h(l represents the length, b represents the
c. Volume=lbh
d. display the volume of the cuboid

### 54.Carefully read the question and answer accordingly. Find which list is not related to stacks?

a. None of the options.
b. First in First Out
c. Push-down
d. Last In First Out

### 55.Carefully read the question and answer accordingly. Which datastructure is said to be linear data structure?

a. None of the listed options
b. Tree
c. Arrays
d. Graphs

### 56.From the given options identify the appropriate algorithm that hasthe lowest worst-case complexity?

a. Quick Sort
b. Merge Sort
c. Selection Sort
d. Bubble Sort

a. O(nlogn)
b. O(n2)
c. O(n)
d. 0(1)

### 58.Which of the option gives the number of independent paths in theprogram

a. Me Cabes number
b. Boundary Value analysis
c. Equivalence Partitioning
d. Error Guessing

### 59.The SRS document should be

a. Consistent
b. Modifiable
c. Unambiguous
d. All the options