MCQ1 (149+60)
MCQ1 (149+60)
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;
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
3
MCQ1 149 Pages
4
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
}
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
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{
}
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
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
product owner
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
11
MCQ1 149 Pages
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);
}
}
12
MCQ1 149 Pages
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");
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
100
101
102
System.out.println(m);
15
MCQ1 149 Pages
}
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);
}
} ( (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
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
}
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 {
}
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
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
18
MCQ1 149 Pages
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);
}
}
19
MCQ1 149 Pages
}
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);
}
}
20
MCQ1 149 Pages
}
147 Option are not VISIBLE
148
149 public class ExectionHandling {
try {
System.out.println("Hello");
throw 89;
}
Compilation Error
catch(Exception ex)
{
System.out.println("World");
}
}
}
---------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------
21
MCQ1 149 Pages
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
12
23
MCQ1 149 Pages
}
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);
}
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
}
finally { 0
System.out.println("Finally"); Finally
}
}
}
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 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
26
MCQ1 149 Pages
32 }
import java.util.*;
public class Dcoder {
}
33 }
public class mcqtest {
}
34
27
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
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");
}
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
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
31
MCQ1 149 Pages
68
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++;
}
33
MCQ1 149 Pages
class Sample {
public void m1(int a , float b) {
System.out.println("Inside m1 method");
}
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
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; }
36
MCQ1 149 Pages
37
MCQ1 60 Pages
1
MCQ1 60 Pages
2
MCQ1 60 Pages
3
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
4
MCQ1 60 Pages
interface i1{}
interface i2{}
interface i3 extends i1, i2{}
class Two{}
class Three extends Two implements i3{}
try{
throew new IOException();
}
catch(IOException|Exception ex){
System.out.println(ex + "handled");
}
5
MCQ1 60 Pages
6
MCQ1 60 Pages
25
26
27
28
29
30 which of the following is not a build tool Ans:- Jenkins
7
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
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");
}
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
10
MCQ1 60 Pages
11
MCQ1 60 Pages
12
MCQ1 60 Pages
13
MCQ1 60 Pages
3)class Cafe
{
public int cafe=0;
public Cafe(String test){
cafe=9;
}
public Cafe(){}
}
14
MCQ1 60 Pages
15
MCQ1 60 Pages
16
MCQ1 60 Pages
class RoomArea
{float length;
float breadth;
class First {
protected First()
{
System.out.print(2+1);
}
tests()
{
System.out.println("I am default constructor");
}
}
}
74 Zero times
18
MCQ1 60 Pages
class Main
{
public Main()
{ System.out.println("Calling ASE");
}
19
MCQ1 60 Pages
78 0(Zero)
79 Who is responsible for prioritizing Product backlog Product Owner
20