You are on page 1of 2

ANNEXURE-1

Standard Template for Academic Tasks (22231)

1 2 3 4 5

Faculty UID-26121 Faculty name:- Dr. Om Prakash Yadav


Academic Task Number: Test-1 Course code: CSE310
Date of allotment: 5-02-2023 Course title: Programming in Java
Date of submission: 18-02-2023 Maximum Marks: 30(10 MCQ + 20 Code)
Academic Task Type: MCQ and Code Based Test Section:- K21GR

Registration No: _________________ Name: _________________________

Question Question Statement Course Bloom’s Marks per


Number Outcome level Question
1 What will be the output of the following Program? CO2 L2: 2
class main { Understand
private main (byte b) {
this(“Hello”);
System.out.print ("A");
}
public main (double x) {
this(“Hi”);
System.out.print ("B");
}
main (String s) {
System.out.print ("C");
}
public static void main (String [] args) {
new main(1);
}
}
A. AB B. CA
C. CB D. Compilation Error

2 Which of the following statement should be placed in place CO 1 L4 Analyze 2


of statement 1 such that the output is 6?
class main {
public static void main (String [] args) {
int [] arr = {1, 2, 3, 4, 5, 6};
System.out.print (/*statement 1*/);
}
}
A. arr[arr.length-2] + arr[0]
B. arr[1] + arr[arr.length- 1]
C. arr[arr.length-2] + arr[arr.length-1]
D. None of These

Page 1 of 2
ANNEXURE-1
Standard Template for Academic Tasks (22231)

3 What will be the output of the following program? CO 2 L4: Analyze 2


class Demo {
public static short x;
static public void main (String [] rk) {
Demo d = new Demo();
d.show(x);
}
private void show (float a) {
System.out.println(“A”+x);
}
private void show (int b) {
System.out.println(“B”+x);
}
static { x = x+5; }
}

A. A5 B. B5
C. Compilation Error D. Runtime Error

4 What will be the output of the following code snippet? CO 2 L1: 2


Understand
final int x = 1, y = 2;
switch(y)
{
case x-1: System.out.printf("A"); break;
default: System.out.printf("B");
case x: System.out.print("C"); break;
case x+1: System.out.printf("D");
case 3: System.out.printf("E");
}

A. BC B. D C. DE D. Compilation Error

5 What will be the output of the following Code Snippet? CO 2 L4: Analyze 2

int x = 3, y = 1;
int result = x-- > ++y ? --x != y++ ? x-- : y++ : x++;
System.out.println(x+ "" +y);

A. -12 B. 03 C. 13 D. None of These

Page 2 of 2

You might also like