wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Debugging

Total questions: 20

Worksheet time: 17mins

Name
Class
Date
1.

Memory allocation using malloc() is done in?

a)

static area

b)

Heap area

c)

Stack area

d)

Disc

2.

What will be the use of void pointer?

a)

Pointer will not return any value.

b)

Address of any variable of any data type can be assigned.

c)

Address of void method can be stored.

d)

Address of another pointer can be stored.

3.

What will be the output of the program given below?

#include<stdio.h>

int main()

{

printf(“%.0f”,5.89);

return 0;

}

a)

0

b)

5

c)

6

d)

5.89

4.

How many times the loop will be executed?

#include <stdio.h>

Int main()

{ Int x,y;

for(x=5;x>=1;x--)

{

for(y=1;y<=x;y++)

{

printf(“%d\n”,y);

}

}

return 0;

}

a)

15

b)

11

c)

10

d)

13

5.

What will be the output/error?

int main()

{

int i =5;

char c = ‘c’;

int sum = i+c;

printf(“%d”,sum);

return 0;

}

a)

104

b)

103

c)

Error

d)

-121

6.

What will be the output of the following program?

main()

{

static int var = 5;

printf(“%d”,var--);

if(var)

main();

}

a)

12345

b)

012345

c)

543210

d)

54321

7.

Find the output of the below Program?

main()

{

int i = 65;

printf(“sizeof(i)=%d”,sizeof(i));

}

a)

sizeof(i)=1

b)

sizeof(0)=1

c)

sizeof(1)=1

d)

sizeof(i)=2

8.

Bitwise operators can operate upon ?

a)

doubles and chars

b)

floats and doubles

c)

ints and floats

d)

ints and chars

9.

What is Dequeue?

a)

Elements can be added from front

b)

Elements can be added to or removed from both front and rear

c)

Elements can be added from rear

d)

Elements are removed from rear

10.

What will be the output of the following arithmetic expression?

5+3*2%10-8*6

a)

-37

b)

-42

c)

-32

d)

-28

11.

Which will legally declare and initialize an array?

a)

int [] myList = {"1", "2", "3"};

b)

int [] myList = (5, 8, 2);

c)

int myList [] [] = {4,9,7,0};

d)

int myList [] = {4, 3, 7};

12.

Which one of the following will declare an array and initialize it with five numbers?

a)

Array a = new Array(5);

b)

int [] a = {23,22,21,20,19};

c)

int a [] = new int[5];

d)

int [5] array;

13.

What will be the output of the program?

Public class Foo

{

public static void main(String[] args)

{

try

{

return;

}

finally

{

System.out.println( "Finally" );

}

}

}

a)

Finally

b)

Compilation fails

c)

The code runs with no output

d)

An exception is thrown at runtime.

14.

Which of these access specifiers can be used for an interface ?

a)

Public

b)

Private

c)

protected

d)

All the Above

15.

Choose the correct remarks.

a)

C++ allows any operator to be overloaded.

b)

Some of the existing operators cannot be overloaded.

c)

Operator precedence cannot be changed.

d)

None of the above

16.

Which of the following operators cannot be overloaded?

a)

>>

b)

?:

c)

.

d)

Both B and C

17.

The concept of multiple inheritance is implemented in java by

i) Extending two or more classes

ii) Extending one class and implementing one or more interfaces

iii)Implementing two or more interfaces

a)

only (ii)

b)

(i) and (ii)

c)

(ii) and (iii)

d)

only (iii)

18.

A process that involves recognizing and focusing on the important characteristics of a situation or object is known as:

a)

Encapsulation

b)

Polymorphism

c)

Abstraction

d)

Inheritance

19.

In object-oriented programming, new classes can be defined by extending existinG classes.This is an example of:

a)

Encapsulation

b)

Interface

c)

Composition

d)

Inheritence

20.

To prevent any method from overriding, we declare the method as

a)

static

b)

const

c)

Final

d)

none of the above.