0% found this document useful (0 votes)
19 views57 pages

MCQ1 (149+60)

Uploaded by

RUPESH Boora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views57 pages

MCQ1 (149+60)

Uploaded by

RUPESH Boora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

MCQ1 149 Pages

1 class Base {
public int a=3;
public void addFive()
{
a+=5;
System.out.println("Base :");
}

}
class Derived extends Base{
public int a=8;
public void addFive()
{ Derived 3
this.a+=5;
System.out.println("Derived :"+a);
}

}
public class Demo{
public static void main(String args[]) {
Base b=new Derived();
b.addFive();
System.out.println(b.a);
}
}
2 public class Tester {
public static void main(String[] args) {
__Line1__data={"1001,Jack,2000","1002,Dan,1000",
"1003,Jane,2000",
"1004,Stuart,1000"};
int salary[]=new int[data.length];
int sum=0;

for(int i=0;i<data.length;i++){
__Line2__row=data[i];
__Line3__normalData=row__Line4;
int sal=__Line5__(normalData[2]);
sum=sum+sal;
String[] , String , String[] , split(",") , Integer.parseInt
salary[i]=sal;
}
System.out.println("Salary details");
for(int i=0;i<salary.length;i++)
{
System.out.println(salary[i]);
}
System.out.println("Sum is "+sum);
}
}

It is required to get the sum of salary and populate the salary array with salary.
choose the valid option

1
MCQ1 149 Pages

3 import java.io.IOException;

public class Demo{


public static String m1(){
try {
System.out.println("In try Block");
return "return from try";
}
catch(Exception e) {
return "return from the catch";
In try Block
}
Finally Block
finally {
return from try
System.out.println("Finally Block");
}
}

public static void main(String ar[])


{

System.out.println(m1());
}
}
4 Refer the code below:
public class Tester{
public static void main(String[] args){
String test = "a b c d";
String str[] = test.split(" ");
for(int i=0;i<str.length;i++){ 65 66 67 68
System.out.print(str[i].charAt(0)-32+ " ");
}
}
}
Choose from below the valid option
5 Tina adopted Agile and DevOps in her project. What are the benefits offered by Agile in DebOps Faster Delivery and Failing fast
6 class Example {
public static void main(String[] args) {
String phone = "APPLE";
switch(phone) {
case "Apple": System.out.println("Apple"); APPLE
case "APPLE": System.out.println("APPLE"); Samsung
default: System.out.println("Samsung");
}
}
}
7 Why mainmethod in java is declared as static JVM can call the main method without creating an object of the class
8 Select the most appropriate Statement Anonymous class does not have a name

2
MCQ1 149 Pages

9 public class Tester{


public static void main(String[] args) {
String name = "computer";
StringBuffer sb = new StringBuffer(name);
StringBuffer sb1 = new StringBuffer();
String name1 = // Line 1
char[] c = // Line 2 Line1:- sb.reverse().toString()
Line2:- name1.toCharArray()
for(int i=0;i<c.length;i++) { Line3:- sb1.substring(sb1.length() - 1)
sb1.append(c[i]);
sb1.append("-");
}
System.out.println(//Line 3);
}
}
10 Which keyword ensures that only one thread should execute the method ? Synchronised
11 class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}

public void m1(float a, int b) {


System.out.println("Inside m1 overloaded method");
compile time error at Line 12 "method m1(int,float) is ambigous"
}

public static void main(String[] args) {


Sample s = new Sample();
s.m1(20,20);//Line 12
}
}
12 consider below code snippet what other values can be added to a set without the program using any
errors select all the apply
public static void main(string args[]){
Set mySet=new HashSet(); All the options (Mark all)
mySet.add("Z");
mySet.add("P");
mySet.add("M");
13 class Person{
void display(){
System.out.println("Person display method");
}
}

class Employee extends Person{


public void display(){//Line 8
System.out.println("Employee display method");
} Employee display method
}

public class Test{


public static void main(String[] args){
Person employee=new Employee(); //Line 15
employee.display();
}
}
Choose a valid option
14 6

3
MCQ1 149 Pages

15 public class Tester


{
public static void main(String[] args) {
String s="helloo";
int count =0;
char [] c =s.toCharArray();
for(int i=0;i<c.length;i++)
{
int first = s.indexOf(c[i]);
2
int last = s.lastindexOf(c[i]);
if(first==last)
{
count++;
}
}
System.out.println(count);
}
}
16 Who is responsible for prioritizing the product backlog Product Owner
17 choose from below correct statement
statement A every instance of a class shares the class variable which is one fixed memory location statement A and B
statement B every instance of class gets separate copy of instance variable
18 class A
{
static {
System.out.println("A-static");
}
}
class B extends A
{static {
System.out.println("B-static");
} tester-static
} A-static
public class tester { B-static
static {
System.out.println("tester-static");}
public static void main(String[] args) {
A a=null;
A a2= new A();
B b1=new B();
}

4
MCQ1 149 Pages

19 public class Main {


public static String method() {
try {
System.out.println("In try block");
return "return from try-catch";
}
catch(Exception e) {
return "return from catch";
In try block
}
In finally block
finally {
return from try-catch
System.out.println("In finally block");
}
}

public static void main(String[] args) {


System.out.println(method());
}
}
20 public class Main {
static int c = 0;
public static void main(String[] args) {
Main a1 = c();
Main a2 = c(a1);
Main a3 = c(a2);
Main a4 = c(a3);
}

private Main() { c = 2;
System.out.println("c = " + c + ";");
}
static Main c() {
return c++ > 0? new Main():null;
}
static Main c(Main m) {
return c++ == 1?new Main():null;
}
}
21 public class Exception_Handle{
public static String method(){
try{
System.out.println("in try block");
return "return from try-catch";
}
catch(Exception e){
return "return from catch";
in try block
}
in finally block
finally{
return from try-catch
System.out.println("in finally block");
}
}
public static void main(String[] args){
System.out.println(method());
}
}
Choose one correct answer
22 Which keyword ensures that at a time only one thread should execute the method? synchronized

5
MCQ1 149 Pages

23 public class Tester{

public static void main(String []args){


int[] numbers={216,214,238,189,222,293};
_A_(_B_ _C_){
System.out.println(number); for int number numbers
}
}
}

Choose from below a valid option to complete the above code in the order as it appears to display all the items in the numbers array
24 public class Tester {
public static void main(String[] args) {
__Line1__data={"1001,Jack,2000","1002,Dan,1000",
"1003,Jane,2000",
"1004,Stuart,1000"};
int salary[]=new int[data.length];
int sum=0;

for(int i=0;i<data.length;i++){
__Line2__row=data[i];
__Line3__normalData=row__Line4;
int sal=__Line5__(normalData[2]);
sum=sum+sal;
String[] , String , String[] , split(",") , Integer.parseInt
salary[i]=sal;
}
System.out.println("Salary details");
for(int i=0;i<salary.length;i++)
{
System.out.println(salary[i]);
}
System.out.println("Sum is "+sum);
}
}

It is required to get the sum of salary and populate the salary array with salary.
choose the valid option

6
MCQ1 149 Pages

25 class Employee { 12
int salary=0;
Employee()
{
salary=10;
}
public void changeSalary()
{
salary=salary+1;
System.out.println(salary);
}
}
class PermanentEmployee extends Employee{

public void changeSalary()


{
salary=salary+2;
System.out.println(salary);
}
}
public class Test {

public static void main(String[] args) {

Employee employee= new PemanentEmployee();


employee.changeSalary();
}

}
Find the output of program
26 Not VISIBLE
27 class Person {
void display(){
System.out.println("Person display method");
}
}
class Employee extends Person{
public void display(){
System.out.println("Employee display method");
Employee display method
}
}
public class Test{
public static void main(String args[]) {
Person employee=new Employee();
employee.display();
}
}

7
MCQ1 149 Pages

28 class A{
static
{
System.out.println("A-static");
}
}

class B extends A{
static
{
System.out.println("B-static");
tester-static
}
A-static
}
B-static
public class Tester {
static
{
System.out.println("tester-static");
}
public static void main (String[] args) {
A a1=null;
A a2= new A();
B b1 = new B();
}
}
29 which interface are implemented by output stream closeable ,autocloseable,Flushable
30 not clear

31 class A tester-static
{ A-static
static { B-static
System.out.println("A-static");
}
}
class B extends A
{static {
System.out.println("B-static");
}
}
public class tester {
static {
System.out.println("tester-static");}
public static void main(String[] args) {
A a=null;
A a2= new A();
B b1=new B();
}

8
MCQ1 149 Pages

32 "Refer the code given below. choose the correct option.


interface A {
default void display() {
System.out.print(""A"");
}
}
class Demo implements A{ choose the correct option
public void display() { 1. A
System.out.println(""demo""); 2. Demo
} 3. Compilation error
} 4. Runtime error
public class Test {
public static void main(String[] args) {
A ref = new Demo();
ref.display();
}
}" ANS:- 2.DEMO
33 public class Tester{

public static void main(String []args){


int[] numbers={216,214,238,189,222,293};
_A_(_B_ _C_){
System.out.println(number); for int number numbers
}
}
}

Choose from below a valid option to complete the above code in the order as it appears to display all the items in the numbers array
34
35 public class Exception_Handle{
public static String method(){
try{
System.out.println("In try block");
return"return from try-catch";
}
catch(Exception e){
return "return from catch"; In try block
} In finally block
finally{ return from try-catch
System.out.println("In finally block");
}
}
public static void main(String[] args){
System.out.println(method());
}
}
36 public class Print {
public static void main(String[] args) {
try {
System.out.print("Java" + " " + 1/0);
}
Standard Edition
catch(ArithmeticException e) {
System.out.print("Standard Edition");
}
}
}

9
MCQ1 149 Pages

37 "MATCH THE SCRUM ROLES WITH THE CORRESPONDING RESPONSIBILITIES


1. Product owner: Ans:- A (develops working software)
a,c,b
2.Scrum master: Ans:- C (conducts daily standup meetings)
3.Scrum team: Ans:- B (creates and maintain product backlog)"
38
39
40
41 scrum is used for managing a product. one of the team member peter has the responsibility of defining the overall project vision. peter?

product owner

42 Match the scrum roles with the corresponding responsibility


1. Product owner:- Ans(Create and maintain product backlog)
2. Scrum master:- Ans(conduct daily stand up meetings) 1-B, 2-C, 3-A
3. Scrum team:- Ans(develop working software)

43
44 consider the following code:
import java.io.*;
public class ACC_Input{
public static void main(String a[]) throws IOException{
BufferedReader i = new BufferedReader(new InputStreamReader(System.in));
String New;
I am an Accenturite
while ((New = i.readLine())!= null || New.length()!= 0)
System.out.println(New);
}
}
Assume the input line as "I am an Accenturite".
What will be the output of above code?
45 Handle

1 and 4
46 In Agile there are many roles , who among them is responsible for priortizing the product backlogs
PRODUCT OWNER
47 ______ is a creational pattern that restricts the creation of instances of a class to just one instance Singleton Pattern
48 import java.util.HashSet;
import java.util.Set;
public class Location{
public static void main(String[] args){
Set locSet = new HashSet();
System.out.print(locSet.add("Bangalore"));
System.out.print(locSet.add("Chennai")); truetruetruetruetruetrue
System.out.print(locSet.add("Delhi"));
System.out.print(locSet.add("Hyderabad"));
System.out.print(locSet.add("Mumbai"));
System.out.print(locSet.add("Pune"));
}
}

10
MCQ1 149 Pages

49 public static void main(String[] args){ 1 continue


try{
int i;
for(i=0;i<1;i++){
continue;}
s.o.pln(i+" ");
}
finally{S.O.PLN("Continue");}}
choose one correct answer
50
51
52
53
54 interface TestInterface{
void display(String message);
}
public class Demo {

public static void main(String[] args) {


//Line -X
TestInterface obj=new TestInterface() { 1) TestInterface obj=(message)->System.out.println(message);
public void display(String message) { 2) TestInterface obj=(String message)->System.out.println(message);
System.out.println(message);
}
};
//Line -Y
obj.display("Java");
}
}
55 VISIBLE options
56 which one of the following is not a value for 'dependency scope' in maven export
57
58
59 Question is blur
60 In a project, Devops is adopted by adhering to the below characteristics. Choose the correct
characteristics offered by Devops
1. Stable and operable software
Statement 1 2 and are true
2. Consistent and optimised release process
3. High risk and low throughput of changes
4.Low available and dependable environments
61 Match the scrum roles with the corresponding responsibility
1. Product owner:- Ans(develops working software)
A, C, B
2. Scrum master:- Ans(conduct daily stand up meetings)
3. Scrum team:- Ans(Create and maintain product backlog)
62 Questions is not visible
63
64
65

11
MCQ1 149 Pages

66 public class Tester {


public static void main(String[] args) {
int sum = 0;
String test="hello i love java";
String str=test.indexOf('e')+" "+test.indexOf('a')+" "+test.indexOf(' ')+" "+test.indexOf('a');
for(int i=0;i<str.length();i++){
if(str.charAt(i)!=' ') { 309
sum = sum+str.charAt(i);
}
}
System.out.print(sum);
}
}
67
68 Compilation Error
69
70
71 Question is blur
72
73
74 which is not severity in sonarqube? issues

75 Not VISIBLE

76 . will print your game plan 1 time


77 class Customer{ public customer(int customerid){
private int customerid; this.customerid=customerid;
private String customeName; }
} public customer(String customerName){
identify the correct parameterized constructor declaration [choose 2] this.customerName=customerName;
}

78 class Employee{
double salary=1000;
}
class Increment{
public void incrementEmp(Employee employee){
employee.salary=employee.salary+1;

}
public void incrementInt(int a){
a=a+1;
}
salary:1001.0,a=10
}
public class Tester1002{
public static void main(String[] args){
Employee employee =new Employee();
int a =10;
Increment increment = new Increment();
increment.incrementEmp(employee);
System.out.println("Salary:"+employee.salary);
System.out.println("a: "+a);
}
}

12
MCQ1 149 Pages

79 class A implements l1, l2


{
public void display(){}
public int methodA(int x){return x}
public int methodB(int y){return y}
}

class A extends Thread implements l1, l2


{
public void display(){}
public int methodA(int x){return x}
public int methodB(int y){return y}
}
80 question not available

81 public class Main


{
public static void main(String[] args) {
String s = "helloo";
int count=0;
char[]c=s.toCharArray();
for(int i=0;i<c.length;i++){
int first = s.indexOf(c[i]);
int last = s.lastIndexOf(c[i]); 3
if(first==last){
count++;
}
}
System.out.println(count);
}
}

82 public class Main


{
public static void main(String[] args) {
int t=5;
try{
System.out.print("java"+""+t/0);
} standard edition
catch(ArithmeticException e){
System.out.print("Standard Edition");
}
}
}

83
84 consider below code snippet what other values can be added to a set without the program using any
errors select all the apply
public static void main(string args[]){
Set mySet=new HashSet();
mySet.add("Z"); all the options
mySet.add("P");
mySet.add("M");

85 which one of the following is not a primary component of sonarQube? Sonarlint

13
MCQ1 149 Pages

86 consider below code snippet what other values can be added to a set without the program using any
errors select all the apply
public static void main(string args[]){
Set mySet=new HashSet();
mySet.add("Z"); all the options
mySet.add("P");
mySet.add("M");

87 which of the following align with agile principles?choose? 1.welcome changing requirements
2.ensure customer satisfaction
88 match the scrum roles with corresponding resposibilities 1.product owner -> creates and maintains product backlog
2.scrum master -> conducts daily stand-up meetings
3.scrum team -> develops working software
89 question not VISIBLE
90 public class A
{
static int c=0;
public static void main(String[] args){
A a1=c();
A a2=c(a1);
A a3=c(a2);
A a4=c(a3);

}
private A(){
System.out.println("c=" +c+""); c=1,c=2,c=3,c=4
}
static A c(){
return c++>=0?new A():null;

}
static A c(A a){
return c++>=1?new A():null;

}
91 NOT VISIBLE
92 NOT VISIBLE
93 public class ExamThread extends Thread
{
public void run(){
System.out.print("Run");
}
public static void main(String args[]) throws InterruptedException{
Thread examThread = new ExamThread(); examRunRead
examThread.start();
System.out.print("exam");
examThread.join();
System.out.println("Read");
}
}

14
MCQ1 149 Pages

94 public class TryCatch


{
public static void main(String[] args)
{
try{
int i,num;
num = 10;
for(i=-1;i<3;++i){
num=(num/i);
compliation error
}
}
catch(ArithmeticException e)
{
System.out.print("ArithmeticException");
}
System.out.print(num);
}
}
95 incomplete question
96 incomplete question
97 choose from the below INVALID Loops for(int i=3;i<=99;i*2)
98
99

100
101
102

public static void main{ try{FileOutputStream fout=new FileOutputStream("file.txt");


fount.write(65);}catch(Exception e){print(e)}}

A (This is ans not the option)


104 Which od the following is full software development kit of java JDK
105 import java.util.HashSet;
import java.util.Set;

public class Demo {

public static void main(String[] args) {


// TODO Auto-generated method stub

Set m=new HashSet();


m.add("Z");
m.add("P");
[P, null, A, 12.55, false, Z, M]
m.add("M");
m.add(null);
m.add(12.55);
m.add("A");
m.add(false);

System.out.println(m);

15
MCQ1 149 Pages

106 public class Demo


{
public static void main(String ar[])
{
try
{
throw new IOException();
Compilation Error
}
catch(IOException | Exception ex)
{
System.out.println(ex +"handled");
}
}

}
107 Question is not there
108 No Question
109 No Question
110 class Printer
{
private int inkLevel;
public void printInkLevel()
{
System.out.println(inkLevel);
}

}
public class Demo extends Printer{
int PagePerMin;
void printPagePErMin()
{
System.out.println(PagePerMin);
}

public static void main(String[] args) {

Printer myPrinter=new Demo();


System.out.println( ( (Demo)myPrinter).PagePerMin);
myPrinter.printInkLevel();
}

} ( (LaserPrinter)myPrinter)
myPrinter
111
112
113 Amrita want to use software configuration management in her project. pick need of scm usage from below list of options

ensure integration of code changes


maintain revision history
114
115
116

16
MCQ1 149 Pages

117
118
119
120 choose from the below the correct statement about main(starter) method choose 3. The main method must be decleard as public static void
Java Virtual machine calls the main method directly
Program execution starts from main method only

121 public class Demo {

public static void main(String[] args) {


try
{
System.out.println("Java"+""+1/0);
}
STANDARD EDITION
catch(ArithmeticException e)
{
System.out.print("Standard Edition");
}
}

}
122 Amrita want to use software configuration management in her project. pick need of scm usage from below list of
ensure
options
integration of code changes and maintain revision history
123 public class Demo {

public static void main(String[] args) {


calculator c=new calculator();
int num1=12;
int num2=13;
c.add(num1, num2);
System.out.println(result); // line 5
}

}
Error at line 5 ... result varible is not defined.
class calculator
{
public void add(int num1,int num2)
{
int result=num1+num2;
}
}

124 which method can have implementation/body in Java 8 interface static and default

17
MCQ1 149 Pages

125 import java.util.HashSet;


import java.util.Set;

public class Demo {

public static void main(String[] args) {

Set m=new HashSet();


m.add("Z"); [P, Z, M]
m.add("P");
m.add("M");

System.out.println(m);

}
126 Choose from below the correct statement 1.Java Interpreter convert byte code into machine code and execute it.
2.Java compiler do transaction at once.
127 Find out the correct code at line 1 and Line 2 to serialize the object
Serialiazable,object.writeObject()

128 Select the most appropriate statement. Anonymous class can be reused
Anonymous class does not have a name
We can not create object of anonymous class
Anonymous class can be only public

Ans - Anonymous class does not have a name


129 question not available
130 question not available
131 public class A{
static int c=0;
public static void main(String[] args)
{
A a1=c();
A a2=c(a1);
A a3=c(a2);
A c4=c(a3);
}
private A()
{
c=1 c=2
System.out.print("c=" + c+" ");
}
static A c()
{
return c++>=0?new A() : null;
}
static A c(A a)
{
return c++==0?new A():null;
}
}
132 Question not VISIBLE

18
MCQ1 149 Pages

133 public class Demo


{
public static void main(String ar[])
{
String name="computer";
StringBuffer sb=new StringBuffer(name);
StringBuffer sb1=new StringBuffer();

String name1=sb.reverse().toString(); sb.reverse().toString();


char c[]=name1.toCharArray(); name1.toCharArray();
sb1.subString(0,sb1.length()-1);
for(int i=0;i<c.length;i++)
{
sb1.append(c[i]);
sb1.append("-");
}
System.out.println(sb1.substring(0,sb1.length()-1));

134 }
Question not VISIBLE
135 Question not VISIBLE
}
136 Question not VISIBLE
137 Question not VISIBLE
138 class Employee
{
int salary=0;
public Employee()
{
salary=10;
}
public void changeSalary()
{
salary+=1;
System.out.println(salary);
}
}
class PermanentEmployee extends Test
{
public void changeSalary()
{
12
salary+=2;
System.out.println(salary);
}
}

public class Demo


{

public static void main(String ar[])


{
Employee d=new PermanentEmployee();
d.changeSalary();
}

19
MCQ1 149 Pages

139 public class Sample


{
public static void m1(int a,float b)
{
System.out.println("inside m1");
}

public static void m1(float a,int b)


{
System.out.println("inside overloaded m1"); compilation error m1 method is ambiguous
}
public static void main(String ar[])
{
Sample d=new Sample();
d.m1(20,20);

}
140 public class Employee
{
private _______ int id=1000;
public Employee()
{
STATIC
id++;

}
141 question not VISIBLE
142 Option is missing
143 Incomplete Question
144 class Printer{
int inkLevel;
void printInkLevel() {
System.out.println(inkLevel);
}
}

class LaserPrinter extends Printer{


int pagesPerMin;
void printPagesPerMin() { ((LaserPrinter)myPrinter)
System.out.println(pagesPerMin); myPrinter
}
public static void main(String[] args) {
Printer myPrinter=new LaserPrinter();
System.out.println(__Line1__ pagesPerMin);
__Line2__printInkLevel();
}
}
Choose from below a valid option to complete the above
code in the order as it appears
145 Which of the following is not a Build Tool Jenkins

20
MCQ1 149 Pages

146 public class Demo


{
public static void main(String ar[])
{
String game="your game";
do
{ your game plan
game=game.concat(" plan");
System.out.println(game);
}while(game.length()<10);
}

}
147 Option are not VISIBLE
148
149 public class ExectionHandling {

public static void main(String[] args) {

try {
System.out.println("Hello");
throw 89;
}
Compilation Error
catch(Exception ex)
{
System.out.println("World");
}
}
}

Choose correct option

---------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------

Photo wali pdf ans


1
2 Which of the following will have full software Development Kit of java JDK (Java development kit)
3 Already there

Public class Tester {


byte myValues[] ={81,82,83,85,86};
String m1 = new String(myvalues); QRSTUV
System.out.println(m1); STU
String m2 =m1.substring(2,5);
System.out.println(m2);
}}
4

21
MCQ1 149 Pages

public class ExceptionHandle


{
public static void main(String[] args) {
try{
throw new IOException(); Compilation Error
}
catch(IOException | Exception ex){
System.out.println(ex + "handeled");
}
}
5
6

public class Main


{
public void myMethod(){
System.out.System.out.println("Method");
}
{
System.out.println("Instance block");
}
public void Main(int num){
System.out.println("Constructor");
} Static block 1 Static block 2 Instance block constructor method
static{
System.out.println("Static block 1");
}
static{
System.out.println("Static block 2");
}
public static void main(String[] args) {
Main m =new Main();
m.Main(5);
m.myMethod();
}
7 }
8

22
MCQ1 149 Pages

interface I1
{
public void calculate(int x);
}
interface I2
{
public void calculate(int x);
public void cube(int x);
}

class A implements I1 I1 , A
{ A,A
public void calculate(int x)
{
System.out.println("Square value: "+(x*x));
}
public void cube(int x)
{
System.out.println("Cube value: "+(x*x*x));
}
9 }
10

option c and d

class A implements I1,I2


interface I1
{
{
public void display() {};
void display();
public int methodA(int x) {return x};
int methodA(int x);
public int methodB(int y) {return y};
}
}
interface I2
{
class A extends Thread implements I1,I2
int methodB(int x);
{
}
public void display() {};
public int methodA(int x) {return x};
public int methodB(int y) {return y};
}
11
class TechVersantThread extends Thread
{
public void run()
{
System.out.println("Accenture");
}
public static void main(String[] args) throws InterruptedException {
Runnable r=new TechVersantThread ();
Accenture
Thread myThread=new Thread(r);
myThread.start();

12

23
MCQ1 149 Pages

public class Demo


{
public static void main(String[] args) {
String data[]= {"1001,Jack,2000","1002,Dan,1000","1003,Jane,2000","1004,Stuart,1000"
};
int salary[]=new int [data.length];
int sum=0;
for(int i=0;i<data.length;i++)
{
String row=data[i];
String [] normalData=row.split(arg0);
int sal=
sum+=sal;
String[],String.String[].split().Integer.ParseInt()
salary[i]=sal;

}
System.out.println("Salary Details");
for(int i=0;i<salary.length;i++)
{
System.out.println(salary[i]);
}
}

13
14 Incomplete Question
class Sample
{
public void add(int a,float b)
{
System.out.println(a+b);
}

public void add(float a,int b)


{
System.out.println(a+b);
}
} Compilation error add method is ambiguous

class Demo
{
public static void main(String[] args) {
Sample s=new Sample();
s.add(20,20);
}

15
16 only ans are visible

24
MCQ1 149 Pages

public class ExceptionHandler {


public void divide(int a, int b) {
try {
int c=a/b;
System.out.println(c);
}
catch(Exception e){
System.out.println("Exception");

}
finally { 0
System.out.println("Finally"); Finally
}
}

public static void main(String[] args) {


ExceptionHandler obj = new ExceptionHandler();
obj.divide(0,3);

}
17
18 above question only
19 only ans are visible
import java.util.*;
public class base {
public int a=3;
public void add() {
a+=5;
System.out.println("base");
}
}

class derived extends base{


int a=8;
public void add() {
a+=5;
derived 3
System.out.println("derived");
}
}

class Dcoder
{
public static void main(String[] args)
{
base b= new derived();
b.add();
System.out.println(b.a);

}
20 }

25
MCQ1 149 Pages

interface l1
{
public void calculate(int x);
}
interface l2 extends l1
{
public void calculate(int x);
public void cube(int x);
}
class A implements l1
{
public void calculate(int x) {
System.out.println("Square value:"+(x*x));
}
public void cube(int x) {
System.out.println("Cube value:"+(x*x*x));
}
}
public class Tester {
public static void main(String [] args) {
____ a1=new A();
a1.calculate(4);
____ a2=new A();
a2.cube(4);
}
}
Choose from below TWO valid option to complete the above code,
in the order as it appears that will give the output as
Square value: 16
Cube value: 64
21 l1, A A,A
22 which interface are implemented by outputstream? Closable, Autocloseable, Flushable
23 which keyword ensures that, at a time only one thread should excute the method? synchronized
24
25 which of the following is not build tool? Jenkins
26
27
28
Which of the following ststements are CORRECT?
i) Scrum Team is a group of 7-10 members with all the skills to develop,
test and deliver the working product.
ii) Product Owner is the customer who has given the requirements

29 Choose the most appropriate option both (i) and (ii)


30
31

26
MCQ1 149 Pages

public class Tester {


public static void main(String []args){
String s="helloo";
int count=0;
char[] c=s.toCharArray();
for(int i=0;i<c.length;i++)
{
int first=s.indexOf(c[i]);
int last=s.lastIndexOf(c[i]);
3
if(first==last)
{
count++;
}
}
System.out.println(count);
}

32 }
import java.util.*;
public class Dcoder {

public static void main(String[] args) {


Set s=new HashSet();
s.add(null);
[null, false, 12]
s.add(12);
s.add(false);
System.out.println(s);

}
33 }
public class mcqtest {

public static void main(String[] args) {


String test= " a b c d";
String str[]= test.split(" ");
for(int i=0; i<str.length;i++)
{
System.out.println(str[i].charAt(0)); Compilation error
}

}
34

27
MCQ1 149 Pages

public class Student //code //Line 1


{
int id;
String name;
public Student(int id, String name) {
this.id=id;
this.name=name;
}
}
public class Client {
public static void main(String[]args) {
Serializable, object.writeObject();
Student student=new Student(101, "Mark");
try {
ObjectOutputStream object=new ObjectOutputStream(new FileOutputStream
("student.txt"));
//Line 2

} catch (Exception e) {
e.printStackTrace();
}
}
35 }
class TechVersentThread extends Thread{
public static void main(String[] args) throws Exception{
Thread.sleep(2000);
The code executes normally and prints 'Accenture".
System.out.println("Accenture");
}
36 }
37
38
39
40
public class Tester {
public static void main(String[] args) {

String s = "helloo";
int count = 0;

char[] c = s.toCharArray();
for(int i=0;i<c.length;i++) {
int first = s.indexOf(c[i]);
2
int last = s.lastIndexOf(c[i]);

if(first == last)
count++;
}

System.out.println(count);
}
41 }

28
MCQ1 149 Pages

class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}

public void m1(float a, int b) {


System.out.println("Inside m1 overloaded method");
compile time error at Line 12 "method m1(int,float) is ambigous"
}

public static void main(String[] args) {


Sample s = new Sample();
s.m1(20,20);//Line 12
}
42 }
class Dcoder {

int x = 10;
static {
int x = 10;
System.out.println(x);
10
}
10
public static void main(String[] args) {
Dcoder d = new Dcoder();
System.out.println(d.x);
}
43 }
Faster Delivery
44 Tina adopted Agile and Devops in her project. What are the benefits offered by Agile in DevOps practice Failing fast
45 Question in page 42 not completely visible
"Match the scrum roles with the following responsibilities

1.Product Owner
2.Scrum Master
3.Scrum Team 1-B,2-C,3-A

A)Develops working software


B)Creates and maintains product backlog
46 c)conducts daily stand-up meetings"

47 Question is not clearly visible


48 Question is not clearly visible

29
MCQ1 149 Pages

import java.util.*;
class t extends Thread{
public void run()
{
System.out.println("accenture");
}
}
class Docoder
accenture
{
public static void main(String arg[])
{
Runnable r=new t();
Thread th=new Thread(r);
th.start();
}
49 }
50 Which of the folowing will have full Software Development kit of java JDK
51 choose from below INVALID loop for(int a =6;a==5;a++)
52 which of the folowing is not part of agile manifesto working software over following a plan
53
54
55
56
57
58
59
60
61 Who is responsible for prioritizinig the product backlog Product Owner
class Employee
{
double salary=1000;
}
class Increment
{
public void incrementEmp(Employee employee)
{
employee.salary=employee.salary+1;
}
public void incrementint(int a)
{
Salary :1001
a=a+1;
a: 10
}
}
public class Tester1002{
public static void main(String arg[])
{
Employee employee=new Employee();
int a=10;
Increment increment=new Increment();
increment.incrementEmp(employee);
increment.incrementint(a);
System.out.println("Salary :"+employee.salary);
62 System.out.println("a :"+a);

30
MCQ1 149 Pages

class Employee
{
double salary=1000;
}
class Increment
{
public void incrementEmp(Employee employee)
{
employee.salary=employee.salary+1;
}
public void incrementint(int a)
{
Salary :1001
a=a+1;
a: 10
}
}
public class Tester1002{
public static void main(String arg[])
{
Employee employee=new Employee();
int a=10;
Increment increment=new Increment();
increment.incrementEmp(employee);
increment.incrementint(a);
System.out.println("Salary :"+employee.salary);
63 System.out.println("a :"+a);
Match the scrum roles with the following responsibilities

1.Product Owner
2.Scrum Master
3.Scrum Team 1-B,2-C,3-A

A)Develops working software


B)Creates and maintains product backlog
64 c)conducts daily stand-up meetings
Which keyword ensures that only one thread should execute the method ?
Synchronized
65
public class Tester{
public static void main(String[] args) {
String name = "computer";
StringBuffer sb = new StringBuffer(name);
StringBuffer sb1 = new StringBuffer();
String name1 = // Line 1
char[] c = // Line 2 Line1:- sb.reverse().toString()
Line2:- name1.toCharArray()
for(int i=0;i<c.length;i++) { Line3:- sb1.substring(sb1.length() - 1)
sb1.append(c[i]);
sb1.append("-");
}
System.out.println(//Line 3);
}
66 }
Which of these lambda expressions are valid?
1. () -> 42
2. () -> 42;
1,5
3. (a,b) -> return a > b
4. (a, b) -> return a > b;
67 5. (a, b) -> { return a > b; }

31
MCQ1 149 Pages

68

Question From pdf shared by sheshu // edited by samir

Scrum is used for managing a product/application.


1 One of the team member, Peter has a responsibility of .. Product Owner
overal project vision.What is the scrum role played by him?

Topic: Agile and DevOps


Sub Topic: DevOps Overview
Sean, a DevOps Engineer is planning to adopt continuous deployment
is his project for faster delivery of the product.Which tool can ber used to Jenkins
accomplish his goal?

2 Choose the most appropriate option.


Topic: Agile and DevOps
Sub Topic: DevOps Overview
Sean wants to implement source code management in
//option are not clear so manage with this
his project.Identify the correct usage of SCM from
1.Ensure integration
the below list of option.
2.Manage
3 Choose the most appropriate option.
Topic: Agile and DevOps
Sub Topic: Agile Overview
Scrum is used for managing a product/application.
One of the team member, Peter has a responsibility of .. Product Owner
overal project vision.What is the scrum role played by him?

4 Choose the most appropriate option.


Topic: Agile and DevOps
Sub Topic: Agile Overview
In Agile, there are many roles.Among them, who is responsible
Product Owner
for priotizing the product backlog?
Choose the most appropriate option.
5
Which of the following statement is correct?
i) Scrum team is a group of 7-10 members with all the skills to develop,
test and delivery of working product.
ii)Product owner is the customer who has give the requirements.
Both i & ii
Choose the most appropriate option.

6
class A implements I1,I2 {
public void display() {};
public int methodA(int x) { return x;}
public interface I1 { public int methodB(int x) { return x;}
void display(); }
int methodA(int x);
}
public interface I2 { class A extends Thread implements I1,I2 {
int methodB(int x); public void display() {};
} public int methodA(int x) { return x;}
public int methodB(int x) { return x;}
7 Which of the following classes will compile ? [Choose 2] }

32
MCQ1 149 Pages

In a Project, DevOps is adopted by adhering to the below characterstics. Choose the correct
characterstics offered by DevOps
1.Stable and operable software
2.Consistent and optimised release process
3.High risk and low throughput of changes
8 4.Low available and dependable environments statement 1 and 2 are true
9 Which methods have implementation/body in java 8 interface? [choose 2] static, default

Amritha wants to use Software Configuration management in her project. Ensure integration of code changes
10 Pick the need of usage of SCM from below options [choose 2] Maintain revision history
class Hotel
{
public int bookings;
private void book()
{
bookings++;
}

class SuperHotel extends Hotel


{
public void book()
{
bookings--;
}
1. change line 3 to public void book() and line 20 to hotel.book();
public void book(int size) 2. change line 19 to SuperHotel hotel=new SuperHotel();
{
book();
bookings+=size;
}

public class TestHotel


{

public static void main(String ar[])


{
Hotel hotel=new Hotel();
hotel.book(2);
11
System.out.println(hotel.bookings);

33
MCQ1 149 Pages

class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}

public void m1(float a, int b) {


System.out.println("Inside m1 overloaded method");
}

public static void main(String[] args) {


Sample s = new Sample();
s.m1(20,20);//Line 12
} int a,int b
} float a,float b
which one of the following cannot be declared as static constructor

public class Tester{


public static void main(String[] args){
String a[]={"rat","cat"};
String str="bat";
a[1]=str;
str="mat";
for(int i=0;i<str.length(),i++)
{
//line1
//line2
}}}
choose from below a valid option to complete the above code ,in the order as it appear int x =str.charAt(i)-32
that will gove the output as MAT System.out.print((char)x);

public class Tester{


int x =10;
static{
int x =20 20
System.out.println(x); 10
}
public static void main(String[] args){
Tester t = new Tester();
System.out.println(t.x);
}}

34
MCQ1 149 Pages

class vehicle{
public vehicle(int manufacturingyear){
display();
System.out.println("vehicle manufactured in the year:"+manufacturingyear);}
public vehicle(String registrationNo){ car display method
display(); vehocle manufactured in the year:2020
System.out.println("vehicle created with registration no:"+registrationNo);} car created
public void display(){
System.out.println("vehicle display method");}}
class car extends vehicle{
public car(){
super(2020);
S.o.pln("car created");}
public car(int manufacturingYear){
super(manufacturingYear);
S.O.PLN("Car manufactured in the year:"+manufacturingYear);
public class ExamThread extends Thread
{
public void run(){
System.out.print("Run!);
}
public static void main(String args[]) throws InterruptedException{ when excecuted ,it print one of the following eat!run! relax! or Run! Eat! Relax!
Thread examThread = new ExamThread();
examThread.start();
System.out.print("Eat!");
examThread.join();
System.out.println("Relax!");
}
}
interface I1{
int i = 1111;
void method1();
}
interface I2{
int i =2222;
public void method1();
} 3333 3333 3333
interface I3 extends I1, I2{
int i =3333;
public void method1();
}
class A implements I3{
public void method1(){
System.out.println(i);
}
}
What needs to be implemented to use lambda expression Functional Interface
Which method restarts the thread? none
Lambda expressions are based on Functional Programming

35
MCQ1 149 Pages

It must have exactly one abstract method and may


have any number of deafault or static methods.
Which of the following options are valid with respect to functional interface?
Runnable declares a method run. What’s the signature? public void run()
Functional interfaces can be annotated as @FunctionalInterface

What would be the output of the following program?


public class HashMapTest {
public static void main(String[] args) {
Map<Integer, String> hashMap = new HashMap<>();
hashMap.put(101, "Venkat Rajaram");
hashMap.put(102, "Tia Mathew"); key = 101 Value = Venkat Rajaram key = 102 Value = Fatemah Ibrahim
hashMap.put(102, "Fatemah Ibrahim");
Set<Integer> keys = hashMap.keySet();
Iterator<Integer> itr = keys.iterator();
while (itr.hasNext()) {
Integer key = itr.next();
String value = hashMap.get(key);
System.out.println("key = " + key + "\tValue =" + value);
}
}
}
Which collection implementation is used to store a group of account numbers in a sorted manner. Treeset

linkedHashSet
Prem wants to store group of unique Transaction objects.
He wants to keep the insertion order.
Which collection implementation
can be used to achieve this?

Which of these lambda expressions are valid?

1. () -> 42 1. () -> 42
2. () -> 42; 5. (a, b) -> { return a > b; }
3. (a,b) -> return a > b
4. (a, b) -> return a > b;
5. (a, b) -> { return a > b; }

36
MCQ1 149 Pages

What will be the output of the following java code?


public class TryCatch{

public static void main(String[] args) {


try {
int i,num;
num=10;
for(i=-1;i<3;++i)
{
num=(num/i);
} Compilation Error
}
catch(ArithmeticException e)
{
System.out.println("Arithmatic Exception");
}
System.out.println(num);
}
}

Choose the correct answer


Refer the code given below: 1) class A implements l1,l2{
public void display() {}
interface l1{ public int methodA(int x) {return x;}
void display(); public int methodB(int y) {return y;}
int methodA(int x); }
}
interface l2{ 2) class A extends Thread implements l1,l2{
int methodB(int x); public void display() {}
} public int methodA(int x) {return x;}
public int methodB(int y) {return y;}
Which of the following class will compile?[Choose 2] }
Which of the following will have full Software Development Kit of JAVA ? JDK
What will be the output of the following code snippet?
public static void main(String[] args) {
try {
int i;
for(i=0;i<1;i++)
continue;
System.out.println(i+" ");
Continue
}
finally
{
System.out.println("Continue");
}
}
Choose one correct answer.

37
MCQ1 60 Pages

Page No Questions (Full) Answer (Write Full Answer if possible)


1 which one of following cannot be declared as static? constructor
2 which one of the following is not a severity in SonarQube? issues
3

Refer the code given below


public class Tester{
public static void main(String[] args){
String a[] ="APPLE";
switch(phone){
case "Apple" System.out.println("Apple");
case "APPLE" System.out.println("APPLE");
default System.out.println("SAMSUNG");
}
}
} APPLE
4 choose from below a valid option SAMSUNG
public Customer(int customerid){
this.customerid=customerid;
Refer the class given below }
class Customer{
private int customerid; public Customer(String customerName){
private String customerName; this.customerName=customerName;
} }
5 identify the correct paramterized constructor declarations[choose2]

1
MCQ1 60 Pages

refer the code given below


public class Tester{
public static void main(String[] args){
String a[] ={"rat,"cat"};
String str ="bat";
a[1]=str;
str="mat";
for(int i =0;i<str.length(),i++)
{
//line1
//line2
}
}
}
choose from below a valid option to complete the above code int x = str.charAt(i)-32
6 in the order as ifappear,thet will give the output as MAT System.out.print((char)x);
Refer the incomplete code given below
public class Tester{
public static void main(String[] args){
int[][] intArray={{1,2,3},{3,4},{5,6,7,8}};
int [] result=________Line1________'
for(int i=0;i<________Line2________;i++){
int sum=0;
for(int j=0;j<________Line3________;j++){
int sum=sum+________Line4__________;
result[i]=sum;
}
}
for(int i=0;i<result.length;i++){
System.out.println(result[i]);
}
}
}
it is required to find the sum of values in each row of intArray and it in result array
choose from below a valid option to complete the above code new int[intArray.length]
in the order as ifappear,thet will give the output as intArray.length
6 intArray[i].length
7 intArray[i][j]
7

2
MCQ1 60 Pages

Refer the incomplete code given below


class Printer{
int inkLevel;
void printInkLevel();
System.out.println(inkLevel);
}
}
class LaserPrinter extends Printer{
int pagesPerMin;
void printPagesPerMin(){
System.out.println(pagesPerMin);
}

public static void main(String[] args){


Printer myPrinter=new LaserPrinter();
System.out.println(_____Line1____.pagesPerMin);
_____Line2______.printInkLevel();
}
} ((LaserPrinter)myPrinter)
8 choose from below a valid option to complete the above code in the order as it appears myPrinter
consider the code given below
class Employee{
int salary=0;
Employee(){
salary=10;
}
public void changeSalary(){
salary=salary+1;
System.out.println(salary);
}}
class PermanentEmployee extends Employee{
public viud changeSalary(){
salary=salary+2;
System.out.println(salary);
}}
public class Test{
public static void main(String[] args){
Employee employee=new PermanentEmployee();
employee.changeSalary();
}}
9 choose from below a valid option 12

3
MCQ1 60 Pages

Refer the code given below


class Employee{
private______ int id =1000;
public Employee(){
id++;
}
}

The ABC organization wants auto increment their


10 employee's Id . Choose from below a valid option static
Refer the code given below

class A{
static{
System.out.println("A-static");
}
}
class B extend A
{
static{
System.out.println("B-static");
}
}
public class Tester1{
ststic{
System.out.println("tester-ststic");
}
public ststic void main(String [] args){
A a1=null;

.....
...
...
... tester-ststic
A-static
11 }} B-static

4
MCQ1 60 Pages

interface i1{}
interface i2{}
interface i3 extends i1, i2{}
class Two{}
class Three extends Two implements i3{}

public class Tester{


public static void main(String args[]){
i3 obj = new Three();
if(obj.instanceof i1)
System.out.println("Object created is an instance of i1");
if(obj instanceof i3)
System.out.println("Object Created is an instance of i3");
}
}
Object created is an instance of i1
12 Choose from below a valid option. Object created is an instance of i3
"Choose from below the CORRECT statements about main (STARTER) method Choose 3
A.Every class in java should have main method

B.The man method must be declared as public static void

C.Java virtual machine calls the main melhod directly


Ans:B,C,D.
D.Program execution starts from man method only B. The main mathod must be declared as public static void,
C. Java virtual machine calls the main method directly,
13 E.Main method cannot be declared as final" D. Program execution satrts from main method only
what will be the output of the following java code?
pubic class ExcepctionHandle{
public static void main(String [] args){

try{
throew new IOException();
}

catch(IOException|Exception ex){
System.out.println(ex + "handled");
}

14 chose one correct answer Compilation Error

5
MCQ1 60 Pages

Consider below code snippet . what other value can be


added to mySet without the program causing any errors.

Select all to apply.


public static void main(String [] args){
Set mySet =new HashSet();
mySet.add("Z"); mySet.add(null);
mySet.add("P"); mySet.add(12.56);
mySet.add("M"); mySet.add("A");
15 } mySet.add(false);
16
17

18 b)Anonymous class does not have name


19
20
21
Refer the code given below. choose the correct option.
interface A {
default void display() {
System.out.print("A");
}
}
class Demo implements A{ choose the correct option
public void display() { 1. A
System.out.println("demo"); 2. Demo
} 3. Compilation error
} 4. Runtime error
public class Test {
public static void main(String[] args) {
A ref = new Demo();
ref.display();
}
22 } ANS:- 2.DEMO
23 Employee display method
24

6
MCQ1 60 Pages

25
26
27
28
29
30 which of the following is not a build tool Ans:- Jenkins

public class ExceptionHandle


{
public static void main(String[] args) {
try{
throw new IOException();
}
catch(IOException | Exception ex){
System.out.println(ex + ""handeled"");
}
31 } Compilation Error
32 Which keyword ensures that, at a time only thread should execute the method Synchronized

Chhose the below CORRECT statement.


Statement A:Every instance of the class shares the class variable,
which is in one fixed memory
33 Statement B:Every instance of the class get seperate copy of instance variable. Statement A and B

class TechVersentThread extends Thread{


public static void main(String[] args) throws Exception{
Thread.sleep(2000);
System.out.println("Accenture");
}
34 } The code executes normally and prints 'Accenture".

7
MCQ1 60 Pages

public class Print {


public static void main(String[] args) {
try {
System.out.print("Java" + " " + 1/0);
}
catch(ArithmeticException e) {
System.out.print("Standard Edition");
}
}
35 } Standard Edition
Scrum is used for a product/application. One of the team member.
Peter has a responsibility of defining overall project vision.
36 What is the scrum role by played him ? Product owner

Amrita want to use software configuration management in her project. ensure integration of code changes
37 pick need of scm usage from below list of options maintain revision history

public class Tester {


public static void main(String[] args) {

String s = "helloo";
int count = 0;

char[] c = s.toCharArray();
for(int i=0;i<c.length;i++) {
int first = s.indexOf(c[i]);
int last = s.lastIndexOf(c[i]);

if(first == last)
count++;
}

System.out.println(count);
}
38 } 2

8
MCQ1 60 Pages

class A
{
static {
System.out.println("A-static");
}
}
class B extends A
{static {
System.out.println("B-static");
}
}
public class tester {
static {
System.out.println("tester-static");}
public static void main(String[] args) {
A a=null;
A a2= new A();
B b1=new B();
} tester-static
A-static
39 } B-static

class Sample {
public void m1(int a,float b) {
System.out.println("inside m1 method");
}

public void m1(float a,int b) { //Line 6


System.out.println("inside overloaded m1 method");
}
public static void main(String ar[]) {
Sample d=new Sample();
d.m1(20,20); //LIne 12

40 } compilation error aat Line12 method m1(int,float) is ambiguous

9
MCQ1 60 Pages

class Example {
public static void main(String[] args) {
String phone = "APPLE";
switch(phone) {
case "Apple": System.out.println("Apple");
case "APPLE": System.out.println("APPLE");
default: System.out.println("Samsung");
}
} APPLE
41 } Samsung
Which method can have implentation/body in java 8 interface ?
42 [Choose 2] static and default

Refer the code below


class Employee
{
private______int id=1000;
public Employee()
{
id++;
}
}
The ABC organisation wants auto increment their employee Id.
43 choose a valid option static

10
MCQ1 60 Pages

Refer the incomplete code given below


class Printer{
int inkLevel;
void printInkLevel() {
System.out.println(inkLevel);
}
}
class LaserPrinter extends Printer{
int pagesPerMin;
void printPagesPerMin() {
System.out.println(pagesPerMin);
}
public static void main(String args[]) {
Printer myprinter=new LaserPrinter();
System.out.println(__Line1__.pagesPerMin);
__Line2__.printInkLevel();
}
} __Line1__ -> ((LaserPrinter)myprinter)
44 choose from below a valid option to complete the above code in the order it appears __Line2__ -> myprinter

public class Print {


public static void main(String[] args) {
try {
System.out.print("Java" + " " + 1/0);
}
catch(ArithmeticException e) {
System.out.print("Standard Edition");
}
}
45 } Standard Edition
46
47
48
49 Which od the following is full software development kit of java JDK

11
MCQ1 60 Pages

"Public class Tester {


byte myValues[] ={81,82,83,85,86};
String m1 = new String(myvalues);
QRSTUV
System.out.println(m1);
STU
String m2 =m1.substring(2.5);
System.out.println(m2);
}}
50 "
51
52
53
consider below code snippet what other values can be added to a set without the program using any
errors select all the apply
public static void main(string args[]){
Set mySet=new HashSet();
mySet.add("Z");
mySet.add("P");
54 mySet.add("M"); All the options (Mark all)
55
56
57
58
59
60
61 Double method

12
MCQ1 60 Pages

public class Calculator


{
void add(int addd)
{
System.out.println("int");
}
void add(float ddb)
{
System.out.println("float");
}
void add(double ddda)
{
System.out.println("dou");
}
public static void main(String s[])
{
Calculator c=new Calculator();
c.add(12.24);
}
62 } 4.13 6.26
public class Condition
{
public static void main(String s[])
{
double var1=3.13;
double var2=3.13;

for(int z=3; z>=3; --z)


{
if((--var2 > 1) && (var1++ > 2))
{
var2=var1+var2;
}
}
System.out.println(var1 + " " + var2);
}
63 } 11

13
MCQ1 60 Pages

3)class Cafe
{
public int cafe=0;
public Cafe(String test){
cafe=9;
}
public Cafe(){}
}

public class Cafeteria extends Cafe


{
public Cafeteria(String text)
{ cafe=11;}

public static void main(String s[])


{
System.out.println(new Cafeteria("test").cafe);
}
64 } The code will give compilation error at Line 1
public class Demo
{
public static void main(String s[])
{
int i=1;
while(i--) //Line 1
{
System.out.println(i + " ");
}
}
}
65 Integer value is not initialized

14
MCQ1 60 Pages

public class Morning


{
static String value="testify";
static int value1=25;
static {
value1=50;
System.out.println(value);
System.out.println(value1);
}
public static void main(String s[])
{System.out.println(value);
}
66 } testify 50 testify
interface Vehicle
{
int noOfWheels;
}
public class Car implements Vehicle
{
public static void main(String s[])
{ System.out.println(Car.noOfWheels);
}
}
67
public class Testing
{
public static void main(String s[])
{int intx=100;
boolean BVal1=true;
boolean BVal2=false;

if( (intx !=4)&& (intx >=99) || !BVal1)


System.out.println("Accenture");
System.out.println("IDC");
BVal2=BVal1;
if( (BVal2=true) && BVal1 != BVal2)
System.out.println("High Performance Delivered");
}
68 } Accenture IDC

15
MCQ1 60 Pages

public class Testing


{
public static void main(String s[])
{
double value[]=new double [81];
value[1]=21.23;
System.out.println("Array val contain" + value[0]);
}
}
69 Array val contain0.0
public class Activate
{
public static void main(String s[])
{
double finalResult=captureResultA(37.5);
double finalValue=captureResultB(37.5);
System.out.println(finalResult+finalValue);
}
public static float captureResultA(double value)
{
float output=new Float(value);
return output;
}
public static float captureResultB(double value)
{
float output=new Float(value);
return output;
}
}
70 Area = 75.0

16
MCQ1 60 Pages

class RoomArea
{float length;
float breadth;

void getData(float a, float b)


{length=a;
breadth=b;
}
}
public class Multiple
{public static void main(String s[])
{float area;
RoomArea room=new RoomArea();
room.getData(15,5);
area=room.length * room.breadth;
System.out.println("Area: " + area);
}
71 } 339

class First {
protected First()
{
System.out.print(2+1);
}

class Second extends First{


protected Second()
{
System.out.print(4+5);
} I am default constructor is printed once
72
}

class Third extends Second {


protected Third()
{
System.out.print(2+5);
}

public class InherentNumber {


public static void main(String args[])
{ 17
new First();
MCQ1 60 Pages

public class tests


{int a;

tests()
{
System.out.println("I am default constructor");
}

public static void main(String s[])


{
tests t1=new tests();
}
73 } "i am exception" is printed
public class MainClass
{ public static void main(String s[])
{ int i=1;
int j=0;
try
{
System.out.println(i/j); //line 1
}
catch(Exception e)//block 1
{
System.out.println("i am exception");
}
catch(ArithmeticException m)//block 2
{
System.out.println("i am arith exception");
}

}
}
74 Zero times

18
MCQ1 60 Pages

class Main
{
public Main()
{ System.out.println("Calling ASE");
}

public void show()


{ System.out.println("show");
}
}

public class Attention


{
public static void main(String s[])
{
Main the_values[]=new Main[3];
}
}
75 b3=166
public class Acc_Byte1
{
public static void main(String s[])
{
int b1=80;
int b2=100;
int b3;
b3=++b1 * b1/100 + ++b2;
System.out.println("b3: " + b3); one
} two
76 } default

19
MCQ1 60 Pages

public class SwitchD


{
public static void main(String s[])
{
int i=1;
switch(i){
case 0: System.out.println("zero");break;
case 1: System.out.println("one");
case 2: System.out.println("two");
default: System.out.println("default");
}
}
77 } 15
public class Sacrifice
{
private int variableA=showOutput();
private int variableB=15;

private int showOutput()


{
return variableB;
}
public static void main(String s[])
{System.out.println( (new Sacrifice()).variableA);
}
}

78 0(Zero)
79 Who is responsible for prioritizing Product backlog Product Owner

20

You might also like