Hello friends in this article we are going to discuss about Java Primmer Multiple Choice Questions with Answers | Java Primmer Objective type questions with answers | Java Primmer Dump questions with answers
1.If you are asked to do a modular software design, which combination of coupling and cohesions should you use for designing the software?
a. High cohesion and high coupling
b. High cohesion and low coupling
c. Low cohesion and high coupling
d. Low cohesion and low coupling
Ans:b
2.Statement: For a logically cohesive module, there are some activities to be implemented . These
activities are preferred from inside the module itself. Is the above given statement true? If not,
choose the correct option to make it true.
a. The activities are selected from outside the module.
b. The activities are selected in a random manner.
c. The activities are selected in a sorted manner.
d. The given statement is true.
Ans:a
3.What kind of controlled structure is used when we don’t know the exact number of times a
code needs to be executed?
a. switch
b. while
c. for
d. if-else
Ans:b
4.Which of the given statements is true about XP?
a. XP narrows down towards a single project developed and numbered by a single team.
b. XP will not work in environment where the manager insists on complete documentation before
the team begins to code
c. XP will work in the environment where programmers are separated geographically.
d. XP is best suited to work with systems that have scalability issues.
Ans:a,b,d
5._____________________testing is done by client in the real world environment.
a. Alpha
b. beta
c. system
d. gamma
Ans:b
6.Which two phases of feature driven development are repeated until no more feature exist?
a. Develop an overall model
b. Plan by feature
c. Design by feature
d. Build a feature list
e. Build by feature
Ans:c,e
7.Predict the output
What will be the output for the given code snippet
startprogram
public class Main {
public static void main(String[] args) {
try {
System.out.println(4/0);
try{
Int[] a={1,2,3};
System.out.println(a[3]);
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println(“Out of bounds”);
}
}catch(ArthmeticException e){
System.out.println(“ArithmaticException : divide by 0”);
}
}
}
endprogram
a. out of bounds ArithmaticException : divide by 0
b. runtime error
c. out of bounds
d. ArithmaticException: divide by 0
Ans:d
8.Which of the following declarations will cause a compile time error?
a.int[] scores = null;
b. int[] scores =new int[5];
c. String[] nameArray = new String[10];
d. String[] nameArray = (5,3,2);
Ans:d
9.Arrow symbols in the flowchart is used to show the sequence of steps and the relationship
among them. State true and false
Ans:true
10.Information hiding is achieved through which OOP principle?
a. Inheritance
b. Encapsulation
c. Typing
d. Hierarchy
Ans:b
11.In multibranch, the pipeline names should not contain___________.
a. spaces
c. Monitor
b. special characters
c. numerics
d. variables
Ans:a
12.Which are the phases of CI/CD pipeline?
a. Source
b. Operate
c. Monitor
d. Deploy
Ans:c
13.__________is a conceptual framework where software is developed is iterations.
a. Agile
b. prototyping
c. extreme programming
d. DSDM
Ans:a
14.Predict the output of the following statement. Select substr(“Yellow is A colour”,1,5) from dual;
a. Yellow
b. Yel
c. Yello
d. elow
Ans:c
15.column header is referred as
a. domain
b. attribute
c. table
d. tuples
Ans:b
16.At which level of testing the non-functional requirements are tested?
a. Unit testing
b. system testing
c. Integration testing
d. Acceptance testing
Ans:b
17.Agile methodology does not accepts change of requirements at any stage
Ans:true
18.In a relational database a referential integrity constraint can be done using
a. primary key
b. foreign key
c. secondary key
d. compose key
Ans:b
19.Which of the given options are true with respect to arrays?
a. Array size is fixed
b. The element of an array can be accessed using index.
c. Array element can be sorted by decreasing order
d. Negative values cannot be placed in an array.
Ans:b
20.Name the type of join used to include rows that do not have matching values
a. Cartesian product
b. inner join
c. non equi-join
d. outer join
Ans:d
21.Expand DSDM
a. Dynamic System Development Method
b. Dynamic State Development Method
c. Dynamic System Design Method
d. Data System Development Method
Ans:a
22.A primary key can have null values. State True and False.
Ans:false
23.Meta data is declared as ________in SQL?
a. Data Dictionary
b. Meta Dictionary
c. Meta Information
d. Data Information
Ans:a
24.Which of the following is true about Continuous Integration?
a. It is performed immediately after the developers check-in.
b. Development team sends continuous code merging requests even when the testing process is
running
c. It emphasis on the change in all stages of your production pipeline
d. It is an approach of testing each code to codebase automatically.
Ans:a,b,d
25.The practice of automatically provisioning a new environment at the time of deployment is referred to as _________
a. Continuous Integration
b. Continuous Development
c. Infrastructure-as-Code
d. Configuration Management
Ans:c
26.Scrum divides the development into short cycles called___________.
a. Spirals
b. Tracks
c. Lanes
d. Sprints
Ans:a
27.Which of the following is a correct declaration in java?
a. char[] Tic = new char();
b. char[] Tic = new char[19];
c. char[] Tic = new char(14);
d. char[] Tic = new char[];
Ans:b
28.Raghav has developed an application to automate the billing process of the A arvee
Departmental Store. When the product is in operation, the client found that the place of the phone number, it prints the Customer ID. So he approaches Raghav to fix the issue. What type of Maintenance does the above scenario depict?
a. Corrective
b. Adaptive
c. Predictive
d. Preventive
Ans:a
29.Consider the scenario: You have written a code to display a menu on the screen and some operation are preformed based on the given user input. Which control structure would you use, so that the menu is guaranteed to show/display at least once on the screen, before performing the operation.
a. for loop
b. While loop
c. Do-While loop
d. Case
Ans:c
30.Predict the output for the given pseudo code snippet. SET count = 1
While count less than or equal to 5
Print “Hello, world”
Count = count + 1
END WHILE
a. Prints” Hello, world” 5 times
b. Prints “Hello, world” 6 times
c. loop goes on infinitely
d. Prints “Hello, world” 4 times
Ans:a
31.Pinky and Raju are working on an insurance project. They are not aware of SVN. So they created
a common project on the server. Both retrieved the project from the server. They made relevant
changes to the life. First Raju saved the changes to the server. Next Pinky saved her project identify
which of the given statements are true.
a. Both their changes get updated on the server.
b. Pinky’s changes alone are stored and when Raju tries the upload, the server notifies the
differences.
c. Both Pinky and Raju’s changes get rolled back.
d. Pinky’s project over writes the changes done by Raju.
Ans:d
32.Statement: For a logically cohesive module, there are some activities to be implemented. These
activities are preferred from inside the module itself.
Is the above given Statement true? If not, choose the correct option to make it true.
a. The activities are selected from outside the module.
b. The activities are selected in a random manner.
c. The activities are selected in a sorted manner.
d. The given statement is true.
Ans:a
33.does the special group or group 0 is included while coupling groups using the groupCount in java.
Ans:true
34.Many_________________ are delivered in an agile process.
a. Builds
b. Software
c. Programs
d. Tests
Ans:b
35.Predict the output
startprogram
class Product
{
String productName;
}
class Mobile extends Product
{
String mobileName;
void display()
{
super.productName = mobileName + “Brand New !”;
System.out.println(mobileName +” “ + productName);
}
}
class Main
{
public Static void main(String args[])
{
Mobile obj = new Mobile();
obj.productName=”1”;
obj.mobileName=”2”;
obj.display();
}
}
endprogram
a. 2 2Brand New !
b. 1 2Brand New !
c. 1 1Brand New !
d. Brand New !
Ans:a
36.Predict the output
What will be the output for the given code snippet
Startprogram
Public class Main{
public static void main(String args[])
try {
System.out.println(4 / 0);
try {
int[] a = {1,2,3};
System.out.println(a[3]);
} catch(ArrayIndexOutOfBoundsException e){
System.out.println(“Out of bounds”);
}
} catch (AritjmeticException e) {
System.out.println(“AritjmeticException : divide by 0”);
}
}
}
endprogram
a. Out of bounds AritjmeticException : divide by 0
b. Runtime error
c. Out of bounds
d. AritjmeticException : divide by 0
Ans:d
38.Predict the output
What will be the output for the given code snippet
startprogram
Public class Main{
public static void main(String args[])
int a =10;
for(int i=3;1>=0;1++)
try{
System.out.println(a / i);
System.out.println(“End of try”);
}
catch(ArithmaticException e) {
System.out.println(e);
}
}
}
a. 3
5
10
Java.lang.ArithmeticException: / by zero
10
b. 3
End of try
5
End of try
End of try
Java.lang.ArithmeticException: / by zero
c. Compiletimeerror
d.runtimeerror
Ans:b
39.Predict the output
What will be the output for the given code snippet
Startprogram
Import java.util.regex;
Public class Main{
public static void main(String args[]){
String s=”ABC”;
Pattern p=Pattern.compile(s);
String r=”ABCABCABCABC”;
Matcher m=p.matcher(r);
System.out.println(m.lookingAt());
}
}
endprogram
a. true
b. false
c. ABC
d. 0
Ans:a
40.Predict the output
What will be the output for the given code snippet
startprogram
Import java.util.regex;
Public class Main{
public static void main(String args[])
{
Pattern p=Pattern.compile(“\d”);
String test=”India123”;
Matcher m=p.matcher(test);
If(m!null)
{
System.out.println(m.find());
}
}
}
endprogram
a. true
System.out.println(m.matches());true
b. false
true
false
c. true
d. false
false
Ans:c
41.Predict the output
What will be the output for the given code snippet
startprogram
Public class Main{
public static void main(String args[])
{
int arr[] = new int[] {0,1,2,3,4,5,6,7,8,9};
int n=6;
n = arr[arr[n] / 2];
System.out.println(arr[n] / 2);
}
}
endprogram
a. 2
b. 1
c. 6
d. 0
Ans:b
42.Predict the output
public class Main{
public static void main(String args[])
{
int[]m = new int[13];
System.out.println(“m[0] is ” +m[0]);
}}
(a.) Program has a compiler error
(b.) Program has a compiler error
(c.) The program runs fine and displays m[0] is 0.
(d.) None
Ans:c
43.Predict the output
import java.util.regex.*;
public class Hello {
public static void main(String args[])
{
String s=”REGULAREXPRESSION”;
String r=””;
s=s.replaceAll(r,”,”);
System.out.println(s);
}
}
(a.) ,R,E,G,U,L,A,R,E,X,P,R,E,S,S,I,O,N,
(b.) REGULAREXPRESSION
(c.) None
(d.) All
Ans:a
44.Predict the output
import java.util.Scanner;
public class Main {
static void func(int a,int b) throws ArithmeticException, ArrayIndexOutOfBoundsException
{
System.out.println(10/a);
int[] arr={1,2,3};
System.out.println(arr[b]);
}
public static void main(String[] args)
{Scanner in=new Scanner(System.in);
for(int i=0;i<3;i++)
{
try{
func(in.nextInt(),in.nextInt());
}
catch(ArithmeticException e){
System.out.println(“can’t divide by zero”);
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println(“Out of bounds”);
}
}
}
}
a) 5
2
can’t divide by zero
5
out of bounds
b) 5
1
can’t divide by zero
5
out of bounds
c) Compile TimeError
d) Results in recursion
Ans:c
45.Which plugin are the appropriate functionality plugins used in multibranch pipelines for
validating the pull or change requests. (Select any two)
a) GitHub Branch Source
b) GitHub Main Source
c) Bitbucket Branch Source
d) Bitbucket Main Source
Ans:a,c
46.In code phase, requirements and feedback are gathered from customers and stakeholders.
a) True
b) False
Ans:b
47.Agile is useful when the client requirements are not clear or requirement frequently changes.
a) True
b) False
Ans:a
48.Many _______ are delivered in an agile process.
a) Builds
b) Softwares
c) Programs
d) Tests
Ans:a
49.Predict the output
What will be the output for the given code snippet
startprogram
import java.util.Scanner;
public class Main{public static void throwit(){
System.out.println(“throwit”);
throw new RunTimeException();
}
public static void main(String[] args){
try{
System.out.println(“Hello”);
throwit();
}catch(Exception re){
System.out.println(“Caught”);
}finally{
System.out.println(“Finally”);
}
System.out.println(“After”);
}
}
a) Hello
throwit
Caught
Finally
After
b) Finally
After
c) CompileTimeError
d) throwit
Caught
After
Finally
Ans:c