wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Coding and Debugging

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

What will be the output of this code?

a)

executed

b)

1 executed

c)

0 executed

d)

none of the above

2.

Output:

Enter a number 10

Both are not equal

Find the error and enter the corrected line

(a)  

3.

print("abc.DEF".capitalize())

What will be the output of this code?

a)

Abc.def

b)

abc.def

c)

Abc.Def

d)

ABC.DEF

4.

a=65

print("[%c]"%a)

What will be the output of this code?

a)

[a]

b)

a

c)

[A]

d)

[a]

5.

What will be the output of this code?

a)

fun None

b)

fun fun

c)

None fun

d)

error

6.

a=~4

b=a+4

print(b)

What will be the output of this code?

a)

1

b)

-1

c)

2

d)

-2

7.

a="python"

b="pythoN"

print(a>b)

What will be the output of this code?

a)

error

b)

true

c)

false

d)

none of the above

8.

Which of the following declarations is incorrect in python language?

1.xyzp = 5,000,000

2.x y z p = 5000 6000 7000 8000

3.x,y,z,p = 5000, 6000, 7000, 8000

4.x_y_z_p = 5,000,000

a)

1

b)

2

c)

3

d)

4

9.

Find the error and type the corrected line

(a)  

10.

What will be the output?

a)

bitterbutter

b)

bitter error

c)

Syntax Error

d)

butter error

11.

What will be the output?

a)

16

b)

Syntax Error

c)

10

d)

(6,10)

12.

#include <stdio.h>

// Assume base address of "StudyHard" to be 1000

int main()

{

   printf(5 + "StudyHard");

   return 0;

}

What will be the output?

a)

5StudyHard

b)

Study

c)

Hard

d)

error

13.

#include<stdio.h>

void main(){

int a = 10, b = 5, c;

c = a + b / 3;

printf("%d", c);

}

Desired Output : 5

Find the logical error and Type the corrected line of error

(a)  

14.

#include <stdio.h>

int main()

{

int x = 10,b=20,c;

x+b=c;

printf("%d", c);

return 0;

}

Output:

30

Find the error and type the corrected line of error

(a)  

15.

#include <stdio.h>

int main()

{

int main = 3;

printf("%d", main);

return 0;

}

a)

It will cause a compile-time error

b)

It will cause a run-time error

c)

It will run without any error and prints 3

d)

It will experience infinite looping