Primmer Exam Objective Type Questions with Answer


31.SPOT THE ERROR:
Observe the below algorithm to find the average of three
numbers.
Stepl: Start
Step2: Get num1, num2, num3
Step3: Add num1, num2, num3 and store it in Sum
Step4: Average=sum%3
Step5: Display Sum and Average
Step6: Stop
Identify 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

The correct answer is: a

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

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

The correct answer is: a

34.Carefully read the question and answer accordingly. What
operation is processed for each element in the list

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

The correct answer is: d

35.Time complexity of an algorithm signifies the total time required
by the algorithm to complete its execution with provided
resources. State True or False.

The correct answer is: True

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

The correct answer is: c

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

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

The correct answer is: Heap Sort

38.Method Overriding shows static polymorphism.

The correct answer is: False

39.Which of the following classes are available in the java.lang
package?

(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()

41.State True or False: The accuracy and efficiency of a HashMap can be guaranteed with overriding equals method and hashCode method.

The correct answer is: True

42.import java.util.ArrayList;
import java.util.Iterator;
public class sample {
public static void main(String[] args)
{
}
Arrayl_ist list = new ArrayList();
list.add(“Orange”);
list.add(“suguna”);
list.addf’Apple”);
list.add(“squeeze”);
lterator<5tring> it = list.iterator();
while (it.hasNextO)
{
String inr = it.next();
if(inr.startsWith(“s”))
{
list.remove(inr);
}
}
System, out.println(list);
}

The correct answer is: False

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 []) {
}
X
check();
}

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

45.Predict the output:
public class Topper {
public static void main(String args[])
{
TreeSet ts=new TreeSet();
ts.add(“30”);
ts.add(“90”);
ts.add(“100”);
ts.add(“40”);
ts.add(“90”);
System.out.printIn(ts);
}
}

The correct answer is: [100,30,40,90]

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

The correct answer is: b

48.Select the principle that best describes the given scenario. An air-
condition can be operated using the button or remote control.

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


The correct answer is: b

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

The correct answer is: b

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

The correct answer is: d

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

52.A program is said to be________ , if it optimizes the amount of
memory and processing time.

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

The correct answer is: b

53.Steve is learning to draw a flowchart to calculate the volume of a
cuboid. Which of the options given below would fit into the process
section 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
breadth, h represents the height)
c. Volume=lbh
d. display the volume of the cuboid

The correct answer is: c

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

The correct answer is: b

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

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

The correct answer is: c

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

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

The correct answer is: b

57.An algorithm which executes on constant time period can be denoted as

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

The correct answer is: d

58.Which of the option gives the number of independent paths in the
program

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

The correct answer is: a

59.The SRS document should be

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

The correct answer is: d

60.Software was developed for Global Marketing. Few changes that was earlier requested was already incorporated in the delivered software. Now the client does not want the changes and requested for the previous release. Which of the below option would facilitate
developer to meet the client needs.

a. Software Repository
b. Software Configuration Management
c. Software Control Management
d. Change Control Management

The correct answer is: d

« Previous      Next »


Leave a Reply

Your email address will not be published. Required fields are marked *