Professional Documents
Culture Documents
}
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;
salary[i]=sal; String[] , String , String[] , split(",") , Integer.parseInt
}
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;
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
11 class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}
3
MCQ1 149 Pages
13 class Person{
void display(){
System.out.println("Person display method");
}
}
4
MCQ1 149 Pages
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();
}
5
MCQ1 149 Pages
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
}
finally{ in finally block
System.out.println("in finally block"); return from try-catch
}
}
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
Choose from below a valid option to complete the above code in the order as it appears to display all t
6
MCQ1 149 Pages
for(int i=0;i<data.length;i++){
__Line2__row=data[i];
__Line3__normalData=row__Line4;
int sal=__Line5__(normalData[2]);
sum=sum+sal;
salary[i]=sal; String[] , String , String[] , split(",") , Integer.parseInt
}
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
25 class Employee { 12
int salary=0;
Employee()
{
salary=10;
}
public void changeSalary()
{
salary=salary+1;
System.out.println(salary);
}
}
class PermanentEmployee extends Employee{
7
MCQ1 149 Pages
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();
}
}
8
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();
}
9
MCQ1 149 Pages
Choose from below a valid option to complete the above code in the order as it appears to display all t
34
10
MCQ1 149 Pages
39
40
41 scrum is used for managing a product. one of the team member peter has the responsibility of definin g
product owner
43
1 and 4
11
MCQ1 149 Pages
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"));
}
}
51
52
53
54 interface TestInterface{
void display(String message);
}
public class Demo {
12
MCQ1 149 Pages
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
2. Consistent and optimised release process Statement 1 2 and are true
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
68 Compilation Error
69
70
71 Question is blur
72
13
MCQ1 149 Pages
73
75 Not VISIBLE
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);
}
}
14
MCQ1 149 Pages
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");
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");
15
MCQ1 149 Pages
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
16
MCQ1 149 Pages
95 incomplete question
96 incomplete question
98
99
100
101
102
17
MCQ1 149 Pages
System.out.println(m);
}
107 Question is not there
108 No Question
109 No Question
18
MCQ1 149 Pages
}
public class Demo extends Printer{
int PagePerMin; void
printPagePErMin()
{
System.out.println(PagePerMin);
}
}
( (LaserPrinter)myPrinter)
myPrinter
111
112
113 Amrita want to use software configuration management in her project. pick need of scm usage from b e
115
116
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
19
MCQ1 149 Pages
}
122 Amrita want to use software configuration management in her project. pick need of scm usage from b e ensure integration of code changes and maintain revision history
}
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
20
MCQ1 149 Pages
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
21
MCQ1 149 Pages
22
MCQ1 149 Pages
23
MCQ1 149 Pages
}
141 question not VISIBLE
24
MCQ1 149 Pages
148
try {
System.out.println("Hello");
throw 89;
}
catch(Exception ex) Compilation Error
{
System.out.println("World");
}
}
}
2 Which of the following will have full software Development Kit of java JDK (Java development kit)
3 Already there
QRSTUV
Public class Tester { STU
byte myValues[] ={81,82,83,85,86};
String m1 = new String(myvalues);
System.out.println(m1);
String m2 =m1.substring(2,5);
System.out.println(m2);
}}
4
25
MCQ1 149 Pages
26
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
{
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));
} I1 , A
9 } A,A
10
interface I1
{
void display(); option c and d
int methodA(int x);
} class A implements I1,I2
interface I2 {
{ public void display() {};
int methodB(int x); public int methodA(int x) {return x};
} public int methodB(int y) {return y}; }
11
27
MCQ1 149 Pages
}
12
}
System.out.println("Salary Details");
for(int i=0;i<salary.length;i++)
{
System.out.println(salary[i]);
}
}
13
14 Incomplete Question
28
MCQ1 149 Pages
class Sample
{
public void add(int a,float b)
{
System.out.println(a+b);
}
class Demo
{
public static void main(String[] args) {
Sample s=new Sample();
s.add(20,20);
}
15
16 only ans are visible
}
finally {
System.out.println("Finally");
}
}
}
17
18 above question only
29
MCQ1 149 Pages
class Dcoder
{
public static void main(String[] args)
{
base b= new derived();
b.add();
System.out.println(b.a);
}
20 }
30
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
26
27
28
31
MCQ1 149 Pages
31
32 }
import java.util.*;
public class Dcoder {
}
33 }
public class mcqtest {
}
34
32
MCQ1 149 Pages
} 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
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]); 2
if(first == last)
count++;
}
System.out.println(count);
}
41 }
33
MCQ1 149 Pages
class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}
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 practi c Failing fast
45 Question in page 42 not completely visible
1.Product Owner
2.Scrum Master
3.Scrum Team 1-B,2-C,3-A
34
MCQ1 149 Pages
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
35
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);
62 System.out.println("a :"+a);
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);
36
MCQ1 149 Pages
1.Product Owner
2.Scrum Master
3.Scrum Team 1-B,2-C,3-A
68
37
MCQ1 149 Pages
6
class A implements I1,I2 { public
void display() {}; public int
methodA(int x) { return x;} public int
public interface I1 { methodB(int x) { return x;} }
void display();
int methodA(int x);
} class A extends Thread implements I1,I2 {
public interface I2 { public void display() {}; public int
int methodB(int x); methodA(int x) { return x;} public int
} methodB(int x) { return x;}
}
7 Which of the following classes will compile ? [Choose 2]
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. Pick Ensure integration of code changes
10 the need of usage of SCM from below options [choose 2] Maintain revision history
38
MCQ1 149 Pages
class Hotel
{
public int bookings;
private void book()
{
bookings++;
}
class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}
39
MCQ1 149 Pages
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);
}}
class vehicle{
public vehicle(int manufacturingyear){
display();
System.out.println("vehicle manufactured in the year:"+manufacturingyear);} car display method
public vehicle(String registrationNo){ display(); vehocle manufactured in the year:2020
System.out.println("vehicle created with registration no:"+registrationNo);} public car created
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);
40
MCQ1 149 Pages
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
41
MCQ1 149 Pages
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?
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; }
42
MCQ1 149 Pages
43
MCQ1 60 Pages
1
MCQ1 60 Pages
2
MCQ1 60 Pages
3
MCQ1 60 Pages
4
MCQ1 60 Pages
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
5
MCQ1 60 Pages
interface i1{}
interface i2{}
interface i3 extends i1, i2{}
class Two{} class Three extends Two
implements i3{}
6
MCQ1 60 Pages
try{
throew new IOException();
}
catch(IOException|Exception ex){
System.out.println(ex +
"handled"); }
17
20
21
7
MCQ1 60 Pages
24
25
26
27
28
29
8
MCQ1 60 Pages
9
MCQ1 60 Pages
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
10
MCQ1 60 Pages
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
11
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");
}
}
compilation error aat Line12 method m1(int,float) is
40 } ambiguous
12
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
13
MCQ1 60 Pages
47
48
14
MCQ1 60 Pages
52
53
consider below code snippet what other values can be added to a set without the
program 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
15
MCQ1 60 Pages
16
MCQ1 60 Pages
3)class Cafe
{
public int cafe=0;
public Cafe(String
test){
cafe=9;
}
public Cafe(){}
}
17
MCQ1 60 Pages
18
MCQ1 60 Pages
19
MCQ1 60 Pages
class RoomArea
{float length;
float breadth;
20
MCQ1 60 Pages
class First {
protected First()
{
System.out.print(2+1); }
tests()
{
System.out.println("I am default constructor");
}
21
MCQ1 60 Pages
}
74 } I am exception
class Main
{
public Main()
{ System.out.println("Calling ASE");
}
22
MCQ1 60 Pages
23
MCQ1 60 Pages
24