Search Header Logo

GFG Final Quiz

Authored by Mokshith Thota

Education

University

Used 1+ times

GFG Final Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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)

1 2 8
1 6 8
1 2 6
6 2 8

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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)))

12
TypeError: f1() takes from 2 to 5 positional arguments but 6 were given
11
13

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

The program doesn't have any mistakes

program doesnot have correct logic

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

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

It will print a triangle of asterisks with n rows

It will print a square of asterisks with n rows and n columns
It will print a line of n asterisks
It will print a pyramid of asterisks with n rows

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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)

12
224
None
Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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;

}

5 5

44

45

54

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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;

}

10 20
20 10
10 1
1 10

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?