wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

HACKATHON HUSTLE(ROUND 2)

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

What is the best way to debug a Python program?

a)
  1. Python -m pdb Python-script.py  

b)

By Rectifying the errors

c)

Both 1 & 2

d)

None

2.

What does "yield" keyword in python imply?

a)
It is used to return a value from a function without terminating the function.
b)
It is used to import a module in Python.
c)
It is used to define a new variable in Python.
d)
It is used to break out of a loop in Python.
3.

Expand PEP in python?

a)

Python Extension Protocol

b)
Python Error Prevention
c)

Python Enhancement Proposal

d)
Python Enhancement Program
4.

which of the following function can be used to generate random numbers?

a)

random( )

b)

randint( )

c)

uniform( )

d)

range( )

5.

Which of the following sorting algorithms has the best average-case time complexity?

a)
Merge Sort
b)

Quick Sort

c)
Selection Sort
d)
Bubble Sort
6.

who created python?

(a)  

7.

what is the output of the following code

def myfunc(n):

for i in range(0, n):

for j in range(0, i+1):

print(" * ",end="")

print("\r")

a)
The output will be a horizontal line of stars.
b)
The output will be a square pattern of stars.
c)
The output will be a pattern of numbers.
d)
The output will be a right-angled triangle pattern of stars.
8.

which of the following pair of words are anagrams?

a)
fast and slow
b)
big and small
c)

night and thing

d)
happy and sad
9.

Which algorithm is used for finding the strongly connected components in a graph?

a)

Bellman-Ford algorithm

b)
Dijkstra's algorithm
c)
Kosaraju's algorithm
d)
Prim's algorithm
10.

What is the space complexity of the iterative implementation of the Fibonacci sequence?

a)

O(n)

b)

O(1)

c)

O(log n)

d)

O(n^2)

11.

What does AVL tree guarantee?

a)

O(log n) time complexity for insert, delete, and search operations

b)

O(n) time complexity for insert, delete, and search operations

c)

O(n log n) time complexity for insert, delete, and search operations

d)

O(n^2) time complexity for insert, delete, and search operations

12.

out put of the following code?

#include <stdio.h>  

enum week { Mon, Tue, Wed, Thur, Fri, Sat, Sun };

  

int main()

{

    enum week day;

    day = Wed;

    printf("%d", day);

    return 0;

}

a)

2

b)

3

c)

It gives error

d)

None

13.

output of the following code?

#include <stdio.h>

int main(){

if (printf(“Hello - World”)) {

    }return 0;

}

a)

It gives Error

b)

Hello - World

c)

Neither 1 or 2

d)

None

14.

what is the correct way to declare pointer in c?

a)
int *ptr;
b)
int *ptr();
c)

int var(*ptr);

d)

int **ptr;

15.

what is the output of the code given below?

#include "stdio.h"

int main()

{

    char a[] = { 'A', 'B', 'C', 'D' };

    char* ppp = &a[0];

    *ppp++;

    printf("%c %c ", ++ppp, --ppp);

}

a)

C B

b)

B A

c)

B C

d)

C A

16.

What will be the output of the following program?

#include <stdio.h>

int main(void)

{

    int i = 40 >> 5 << 3 >> 2 << 1;

    printf("%d", i);

    return 0;

}

a)

0

b)

4

c)

1

d)

40

17.

C supports multithreading?

a)

True

b)

False

18.

Predict the output of below C program?

#include<stdio.h>

int main(void){

  int a = 1;

  int b = 0;

  b = ++a + ++a;

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

  getchar();

  return 0;

}

a)

3 6

b)

3 0

c)

3 5

d)

3 4

19.

who is he?

(a)  

20.

How can a string be converted to a number?

a)
stringify() or parse()
b)
toNumber() or convert()
c)
textToInt() or stringToNum()
d)
parseInt() or parseFloat()