Download as doc, pdf, or txt
Download as doc, pdf, or txt
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 2. What will be the output of the following code snippet? CO2 L2: 2
Understand
String [] [] arr = new String [3][2]; //L1
arr[1] = new String [2];
arr[2] = new String [] {"A", "B"}; //L2
arr[0] = new String []{"X", "Y", "Z"};
System.out.println(arr[1][1] + arr[0][2]);

A. Runtime Error B. Compilation Error in L1


C. NullZ D. Compilation Error in L2
2 CO 1 L4 Analyze 2
What will be the output of the following code snippet?

public static void main (String [] om)


{
one:
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
if( j > i) continue one;
if(i == j) break;
System.out.print(j);
}
System.out.print(i);
}
}
A. 012012 B. 01012
C. 001012 D. 001002

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

3 Identify the Incorrect statement(s). CO 2 L4: Analyze 2

i. byte b = 128;
ii. char c = ‘65’;
iii. double d = 1.5F;
iv. int x = ‘A’;
v. boolean bool = Boolean.parseBoolean(“Hello”);

A. ii & iii B. i & ii


C. i, ii & v D. ii, iv & v
4 Consider the following code CO 2 L1: 2
double x=20.0,y=2.0,z; Understand
int a=4,b=2;
z=x/y+a%b;
z=(x/y<5)? x+y:x-y;
z= (int)(x%a)/(y+z);
z=(int)(x/b)> (a/y) ? (x+y) : (x+b);
what will the value of z for each statement.
A. 10.0, 22.0 , 0.0 , 22.0
B. 10.0, 22.0 , 22.0, 0.0
C. 10.0, 18.0 , 0.0 , 22.0
D. 10.0, 22.0 , 0.0 , 18.0

5 Consider the following function definition CO 2 L4: Analyze 2


class Demo {
static int fun(int a,int b) {
return ( (a<b) ? 0:(a-b));
}
public static void main(String args[]) {
System.out.println(fun(x, fun(x,y)));
}
}

Let x , y be any two non-negative integers, than select


the correct answer

A. Maximum of x and y
B. Positive deference of x and y
C. Minimum of x and y
D. 0

Page 2 of 2

You might also like