wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

UG Code Breaker Challenge Round-1

Total questions: 30

Worksheet time: 24mins

Name
Class
Date
1.

All keywords in C are in ____________

a)

LowerCase letters

b)

UpperCase letters

c)

CamelCase letters

d)

None of the mentioned

2.

for( ; ; ) leads to

a)

infinite loop

b)

finite loop

c)

error

d)

none of these

3.

int test(a,b)

{

pass

}

What does the "int" in the above block of code signify ?

a)

data type of the function

b)

data type of a and b

c)

return type of the function

d)

arguments of the function

4.

Which of the following is not a format specifier ?

a)

%d

b)

%s

c)

%f

d)

%k

5.

A string should always be enclosed in

a)

single quotes

b)

hashtags

c)

curly brackets

d)

double quotes

6.

Null character is represented by

a)

\n

b)

\t

c)

\0

d)

\r

7.

#include <stdio.h>


int main()

{

int arr[5] = {10,20,30,40,50};

printf("%d",arr[2]);


return 0;

}


What will be the output of the above program ?

a)

10

b)

20

c)

30

d)

error

8.

What is the correct statement by the following

1. # refers to a preprocessor

2. # will not executes a set of statements before main program executes

3. # allows you to create a macros

a)

Both 1 & 2 follows

b)

Both 1 & 3 follows

c)

All 1, 2 & 3 follows

d)

Both 2 & 3 follows

9.

What is the correct statement by the following

In “scanf” & refers to

1.) Address of a memory location

2.) Operator refers to Address

3.) Syntax for scanning a Variable

4.) All the above

a)

Only 1&2 follows 

b)

Both 1&3 follows

c)

Only 3 follows 

d)

Only 1 follows

10.

What is the output of the following code

#include<stdio.h>

void main()

{

         int a,*p;

         a=23;

         p=&a;

         *p=92;

         printf(“%d”,++*p);

}

a)

23

b)

93 

c)

Compile Time Error

d)

Runtime Error

11.

What is the output of the following code

#include<stdio.h>

void fun()

{

       int x=9;

       printf(“%d ”,x++);

}

void main()

{

         fun();

         fun();

         fun();

}

a)

10 10 10

b)

10 11 12

c)

9 9 9

d)

9 10 11

12.

What is the output of the following code

#include<stdio.h>

union MyUnion

{    char c[8];    int a,b;    float f;

};

typedef union MyUnion MU;

void main()

{

   MU u;

   clrscr();

   printf("%d",sizeof(u));

   getch();

}

a)

8

b)

Compile Error

c)

4

d)

Garbage Value

13.

Almost all programming languages start arrays at ___

a)

index 0

b)

index 1

c)

index 2

d)

the null character

14.

Which of these is not a data structure?

a)

Stack

b)

Array

c)

Integer

d)

List

15.

Consider the following operation performed on a stack of size 5.


Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);


After the completion of all operation, get the total number of element present in stack is

a)

1

b)

2

c)

3

d)

4

16.

The maximum degree of any vertex in a simple graph with n vertices is

a)

a.n–1

b)

b.n+1

c)

c.2n–1

d)

d.n

17.

What is a hash table?

a)

a) A structure that maps values to keys

b)

b) A structure that maps keys to values

c)

c) A structure used for storage

d)

d) A structure used to implement stack and queue

18.

Which of the following is not a technique to avoid a collision?

a)

a) Make the hash function appear random

b)

b) Use the chaining method

c)

c) Use uniform hashing

d)

d) Increasing hash table size

19.
What is the correct way to create an array with these three numbers: 12  8  15
a)
int[] = {12, 8, 15};
b)
int[] nums = {12  8  15};
c)
int[] nums = {12, 8, 15}
d)
int[] nums = {12, 8, 15};
20.

Find the output

class Test {

public static void main(String args[]) {

int arr[2];

System.out.println(arr[0]);

System.out.println(arr[1]);

}

}

a)

Compile error

b)

Exception

c)

Garbage Value

Garbage Value

d)

0

0

21.

float myFloatNum = 5.99f;

System.out.println(myFloatNum);


What will be the output?

a)

5.99

b)

5.99f

c)

"5.99"

d)

"5.99"f

22.

Which keyword is used to define a constant in a programming language?

a)

final

b)

static

c)

const

d)

constant

23.

What is the result when a student, Avni, is given a test and asked to solve the following problem?

int num = 10; System.out.println(num++);

a)

10

b)

11

c)

0

d)

error

24.

What is the output of the following scenario?

John has 10 apples. If he has exactly 10 apples, he will say "Yes", otherwise he will say "No".

a)

Yes

b)

No

c)

True

d)

False

25.

Which of the following option leads to the portability and security of Java?

a)
  1. Bytecode is executed by JVM

b)
  1. The applet makes the Java code secure and portable

c)
  1. Use of exception handling

d)
  1. Dynamic binding between objects

26.

Evaluate the following Java expression,

if x=3, y=5, and z=10:

System.out.println((++z + y - y + z + x++));

a)

24

b)

23

c)

20

d)

25

27.

What will be the output of the following program?

  1. public class Test {  

  2. public static void main(String[] args) {  

  3.     int count = 1;  

  4.     while (count <= 15) {  

  5.     System.out.println(count % 2 == 1 ? " *** " : " +++++ ");  

  6.     ++count;  

  7.         }      // end while  

  8.     }       // end main   

  9.  }  

a)
  1. 15 times ***

b)
  1. 15 times +++++

c)
  1. 8 times *** and 7 times +++++

d)
  1. Both will print only once

28.
a)

A. Compile Time Error

b)

B. It will print 'Show'

c)

C. No Output

d)

D. Runtime Error

29.
a)

A. Compile Time Error

b)

B. It will print 'A'

c)

C. It will print 'AB'

d)

D. It will print 'BA'

30.
a)

A. Compile Time Error

b)

B. It will print 'Show1'

c)

C. No Output

d)

D. Runtime Error