0% found this document useful (0 votes)
423 views

PLA 1004 Set 2

I. The document provides instructions for a mid-term exam. II. It instructs students to mark their answers directly in the question paper, write their registration number and name, and contains sample exam questions. III. The questions are multiple choice and cover topics like Java, programming concepts, algorithms and data structures.

Uploaded by

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

PLA 1004 Set 2

I. The document provides instructions for a mid-term exam. II. It instructs students to mark their answers directly in the question paper, write their registration number and name, and contains sample exam questions. III. The questions are multiple choice and cover topics like Java, programming concepts, algorithms and data structures.

Uploaded by

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

Instructions:

I. Kindly mark the answers in the question paper itself. II. Put a tick mark over the correct option.
III. Write your registration number and name on all the pages.

Class Number: Reg. No.:

Name :

Invigilator Signature

MID TERM EXAMINATION – July 2023


B.Tech : Fall Semester
Programme : Semester
2023 -2024
Course Name : Competitive Coding Practices Course Code : PLA1004
:
Faculty Name : Slot
Time : 1.5 hours Max. Marks :50
Q.No. Question Description Marks
JDK stands for _?

1 a. Java development kit b. Java deployment kit 1

c. JavaScript deployment kit d. None


Which statement is true about java?
1
2 a. Java is a sequence-dependent programming language
b. Java is a code dependent programming language
c. Java is a platform-dependent programming language
d. Java is a platform-independent programming language
What is the output of the following program?
int arr[] = {1, 2, 3, 4, 5};
1
for ( int i = 0; i < arr.length - 2; ++i)
3 System.out.println(arr[i] + " ");
a. 1 2 3 4 5 b. 1 2 3 4
c. 1 2 3 d. 1 2
The Java Compiler for every platform is different? 1
4
a. True b. False
What is the output of the following program?
public class Test {
public static void main(String[] args) { 1
5 if(true){System.out.println("GoodMornig");}
else{System.out.println("Good");}}}
e. GoodMornig f. GoodMornigGood
g. Good h. None
What is the output of given code?
public class Test{
public static void main(String[] args){ 1
6 int x=15,y=10;
if(x<y){System.out.println(x<y);}
else{System.out.println(x>y);}}}
a. 1 b. false c. 0 d. true
What is the output of following code snippet?
int x = 10, y = 20, z = x++ + ++y; 1
7 System.out.println(++z);}}
a. 33 b. 31 c. 32 d. error

PAGE \* MERGEFORMAT 8
Instructions:
I. Kindly mark the answers in the question paper itself. II. Put a tick mark over the correct option.
III. Write your registration number and name on all the pages.

Which of the following is not valid?


1
8 a. int b1=128; b. int b1= ‘a’; c. int b1=(int)9.9; d. int
b1=false;
In Java by default every decimal value is considered as which data type? 1
9 a. double b. long c. float d. int
What will be the output of above fraction of code?
int a = 100; 1
10 System.out.println(++a);
a. 100 b. 101 c. Not a statement d. None
The Unicode value of ‘a’ is? 1
11 a. 65 b. 96 c. 67 d. 97
What will be the output of code snippet?
int count = 1;
while(count <= 15){ 1
12 System.out.println(count%2 == 1? "***":"+++++");
++count;}
a. 15 times *** b. 15 times +++++ c. 8 times *** & 7 times +++++ d. error
Which of the following for loop declaration is not valid?
1
13 a. for (int i = 99; i >= 0; i/9) b. for (int i = 7; i <= 77; i+=7)

b. for (int i = 20; i >= 2; - -i) d. for (int i = 2; i <= 20; i = 2* i)


What will be the output of given snippet?
StringBuffer s1 = new StringBuffer("Complete");
s1.setCharAt(1,'i'); 1
14 s1.setCharAt(7,'d');
System.out.println(s1);
a. Complete b. Cimpletd c.Iomplede d. Coipletd
Which of the following is a mutable class in java?
1
15 a. java.lang.String b. java.lang.Byte

c. java.lang.Short d. java.lang.StringBuilder
In java, which method is used to read a word value from user? 1
16 a. next() b. nextLine() c. chatAt() d. read()
What is the range of int data type in Java? 1
17 a. -128 to 127 b. -32768 to 32767 c. 0 to 256 d. None
Which of the following are legal statements in java code?
1. int w = (int)888.8;
2. byte x = (byte)100L; 1
18 3. long y = (byte)100;
4. byte z = (byte)100L;
a. 1 and 2 b. 2 and 3 c. 1, 3 and 4 d. All statements are correct
What is the output of given code?
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result = 0;
1
19 for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);
a. 16.46666666666667 b. 16.34 c. 16.46 d. 16.566666644
What will be the output of code?
1
20 int n = 10; System.out.print((n<<1) + (n>>1));
a. 25 b. 40 c. 10 d. 200
What is the time complexity of code?
1
21 for (int i = 1; i <= n; i++) {System.out.println(n)}
a. O (log n) b. O (n log n) c. O(n) d. O(nlog(log n))
22 What is the time complexity of code? 1
int a = 0, b = 0;
for (i = 0; i < N; i++) {a = a + Math.random();}
for (j = 0; j < M; j++) {b = b + Math.random();}

PAGE \* MERGEFORMAT 8
Instructions:
I. Kindly mark the answers in the question paper itself. II. Put a tick mark over the correct option.
III. Write your registration number and name on all the pages.

a. O(N+M) b. O(N*M) c. O(log(N+M)) d. O(M-N)


What will be the time complexity for the following recurrence relation?
T(n) = T(n-1) + c 1
23 T(0) = 1 or c
a. O(log n) b. O(loglog n) c. O(n) d. O(n^2)
Assume that f(n) and g(n) are asymptotically positive. Which of the following is
correct?
a. f(n) = O(g(n)) and g(n) = O(h(n)) ⇒ f(n) = ω(h(n) 1
24 b. f(n) = Ω(g(n)) and g(n) = Ω(h(n)) ⇒ f(n) = O(h(n))
c. f(n) = ω(g(n)) and g(n) = ω(h(n)) ⇒ f(n) = Ω(h(n))
d. f(n) = ω(g(n)) and g(n) = ω(h(n)) ⇒ f(n) = Ω(h(n))
If n is prime, then the value of ϕ(n)=? 1
25 a. ϕ(n)=n-1 b. ϕ(n)=n-2 c. ϕ(n)=(n-1)*(n-2) d. ϕ(n)=n
What is the time complexity of code?
for (int i = 1; i <=n; i=i*3) {System.out.println("Hello");} 1
26
a. O(log₂n) b. O(n log₂n) c. n*log₂(log₂n) d. O(log3 n)

What is the time complexity of following code?


int a = 0, i = N; 1
27 while( i > 0){ a + = i; i / = 2; }
a. O(N) b. O(Sqrt(N)) c. O(log N) d. O(log N)
To measure Time complexity of an algorithms Big O notation is used which:
a. describes limiting behaviour of the function
1
28 b. characterises a function based on growth of function
c. upper bound on growth rate of the function
d. all of the mentioned
If for an algorithm time complexity is given by O(log₂n) then complexity will: 1
29
a. Constant b. Polynomial c. Exponential d. None
If for an algorithm time complexity is given by O(1) then complexity will: 1
30 a. Constant b. Linear c. exponential d. None
What is the time complexity of the Segmented sieve Algorithm? 1
31 a. O(nlogn) b. O(nlog(logn)) c. O(n^2) d. O(n^3)
What is the value of Euler’s phi of 245?
1
32
a. 168 b. 72 c. 120 d. 26
Find the value of x by applying the reminder theorem?
1
33
Input: x=5 mod 8, x = 6 mod 7, x= 4 mod 9
a. 12 b. 10 c. 13 d. 15
Find the value of M1 and M1 by applying the reminder theorem?
1
34
Input: x=4 mod 5, x = 4 mod 7
a. 5 and 7 b. 7 and 5 c. 4 and 5 d. 4 and 7
Which of the following option is valid, when M=10, K=15, N=0, S=1, W=0, E=0; What
will be the return value in Alice apple tree? 1
35
a. 104 b. 10 c. 48 d. -1
How many one-digit strobogrammatic number?
1
36
a. 4 b. 5 c. 3 d. 10
Which option is not a Valid Binary palindromic number? 1
37 a. 455 b. 903 c. 895 d. 765
Which option is a valid Binary Palindromic number?
1
38
a. 843,903,977 b. 951,765,689 c. 561,771,905 d. 403,633,771
39 What is an hourglass in a matrix? 1
a. A subset of values that form a 3x3 pattern
b. A subset of values that form a 4x4 pattern

PAGE \* MERGEFORMAT 8
Instructions:
I. Kindly mark the answers in the question paper itself. II. Put a tick mark over the correct option.
III. Write your registration number and name on all the pages.

c. A subset of values that form a 2x2 pattern


d. A subset of values that form a 5x5 pattern
How many values form an hourglass in a matrix? 1
40
a. 4 b. 6 c. 8 d. 7
If n = 3000, then find the value of ϕ(n)=? 1
41 a. 400 b. 300 c. 200 d. 100
Euclid's algorithm is based on which mathematical concept? 1
42 a. Division b. Addition c. Multiplication d. Subtraction
What is the value of Ac when Sc or N =2 input 4*9 in binary multiplication? 1
43 a. 42 b. 240 c. 16 d. 20
What is the recode(2’s Complement) of 101010 ? 1
44 a. 22 b. 32 c. 42 d. 21
M=01011 and Q=01110 then what the value of Multiplier(recode)? 1
45 a.10000 b. 100-10 c. 1-110-10 d. 010-11
Which is the valid condition of Euclidean algorthim using recursion approach?
1
46 a. euclid(a,a%b) b. euclid(a%b,b)
c. euclid(b%a,a) d. euclid(b%a,b)
If n = 24 and m = 30 then find the value of gcd(n,m)=? 1
47 a. 6 b. 36 c. 18 d. 12
Which of the following option is valid, when M=10, K=15, N=3, S=0, W=1, E=0; What
will be the return value in Alice apple tree? 1
48
a. 104 b. 10 c. 48 d. -1
Find the value of M2 if x=2mod7, x=2mod5, x=7mod9? 1
49 a. 315 b. 45 c. 35 d. 63
If n = 36, then how many switches will be turn on? 1
50 a. 6 b. 5 c. 7 d. 36

PAGE \* MERGEFORMAT 8

You might also like