wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

GFG Final Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What will be the output of the following Python code snippet?

def func(a, b=6, c=8):

print(a, b, c)

func(1, 2)

a)
1 2 8
b)
1 6 8
c)
1 2 6
d)
6 2 8
2.

What will be the output of the following Python code?

def f1(a, b, c=0, d=0, e=0):

return a + b + c + d + e

print(f1(1, *(5, 6)))

a)
12
b)
TypeError: f1() takes from 2 to 5 positional arguments but 6 were given
c)
11
d)
13
3.

n = int(input())

for row_num in range(0,n+1):

row_output = ""

seq_num = row_num

while seq_num > 0:

row_output = row_output + str(seq_num)

seq_num = seq_num - 1

print(row_output)

identify mistakes in program

a)

The program doesn't have any mistakes

b)

program doesnot have correct logic

c)
The program doesn't have a colon at the end of the while loop
d)
The program doesn't have a space between int(input()) and for
4.

n = int(input())

for i in range(n):

if i == 0:

space = (n-1) * " "

print(space + "*")

elif i == n - 1:

print(n " ")

else:

left_spaces = (n - i - 1) * " "

stars = "* " * (i + 1)

print(left_spaces+ stars)

guess the output

a)

It will print a triangle of asterisks with n rows

b)
It will print a square of asterisks with n rows and n columns
c)
It will print a line of n asterisks
d)
It will print a pyramid of asterisks with n rows
5.

What will be the output of the following Python code?

class tester:

def init(self, id):

self.id = str(id)

id = "224"

temp = tester(12)

print(temp.id)

a)
12
b)
224
c)
None
d)
Error
6.

What is the output of the following C code?

#include <stdio.h>

int main() {

int a = 5;

int b = a = 4;

printf("%d %d\n", a, b);

return 0;

}

a)

5 5

b)

44

c)

45

d)

54

7.

What is the output of the following C code?

#include <stdio.h>

int main() {

int a = 10, b = 20, c = 30;

printf("%d ", a);

if (a = b < c)

printf("%d ", a);

else

printf("%d ", b);

return 0;

}

a)
10 20
b)
20 10
c)
10 1
d)
1 10
8.

What is the output of the following C code?

#include <stdio.h>

int main() {

static int var = 5;

printf("%d ", var--);

if (var)

main();

return 0;

}

a)
5 4 3 2 1
b)
5 4 3 2
c)
5 4 3 2 1 0
d)
5 4 3
9.

what is the full form USSR

a)
United States of Soviet Russia
b)
United Soviet States of Russia
c)
Union of Soviet Socialist Republics
d)
United Socialist States of Russia
10.

Largest water falls in the world ?

a)
Niagara Falls
b)
Victoria Falls
c)
Angel Falls
d)
Iguazu Falls