wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Coding Competition and hackathon

Total questions: 60

Worksheet time: 34mins

Name
Class
Date
1.

What is a variable in programming?

a)

A variable is a command that executes a function in programming.

b)

A variable is a symbolic name for a storage location in programming that can hold data and whose value can change.

c)

A variable is a type of error that occurs during program execution.

d)

A variable is a fixed value that cannot be changed in programming.

2.

Explain the difference between a list and a tuple.

a)

A list is a fixed size; a tuple can grow or shrink.

b)

A list is ordered; a tuple is unordered.

c)

A list is mutable; a tuple is immutable.

d)

A list can contain only numbers; a tuple can contain any type.

3.

What is the purpose of a loop in programming?

a)

Loops are designed to handle errors in code.

b)

The purpose of a loop is to create a new function.

c)

A loop is used to store data in a variable.

d)

The purpose of a loop in programming is to repeat a set of instructions until a condition is satisfied.

4.

Define a stack and its basic operations.

a)

A stack is a circular data structure with operations: add (push), take (pop), and last (retrieve end).

b)

A stack is a linear data structure with operations: insert (add), delete (remove), and top (retrieve last).

c)

A stack is a LIFO data structure with operations: push (add), pop (remove), and peek (retrieve top).

d)

A stack is a FIFO data structure with operations: enqueue (add), dequeue (remove), and front (retrieve first).

5.

What is a queue and how does it differ from a stack?

a)

A queue is a linear structure; a stack is circular.

b)

A queue allows random access; a stack does not.

c)

A queue is LIFO; a stack is FIFO.

d)

A queue is FIFO; a stack is LIFO.

6.

What is the time complexity of accessing an element in an array?

a)

O(1)

b)

O(n^2)

c)

O(log n)

d)

O(n)

7.

Describe the concept of recursion with an example.

a)

Recursion involves breaking down a problem into unrelated parts, such as merging lists.

b)

Recursion is a method where a function calls itself to solve smaller instances of a problem, exemplified by the factorial function.

c)

Recursion is a process where a function iterates over a loop to achieve a result, similar to the Fibonacci sequence.

d)

Recursion is a technique where a function runs in parallel to increase efficiency, like sorting algorithms.

8.

What is a binary search tree?

a)

A binary search tree is a type of graph where nodes can have multiple parents and no specific order.

b)

A binary search tree is a collection of nodes where each node can have three or more children, arranged randomly.

c)

A binary search tree is a linear data structure that stores elements in a sequential manner without any hierarchy.

d)

A binary search tree is a data structure where each node has at most two children, with the left child containing values less than the node and the right child containing values greater.

9.

Explain the difference between a linear search and a binary search.

a)

Linear search requires a specific key, while binary search can find any element.

b)

Linear search is faster for large datasets, while binary search is slower for small lists.

c)

Linear search checks each element one by one, while binary search divides the list and checks the middle element.

d)

Linear search uses a sorted list, while binary search works on unsorted data.

10.

What is the purpose of debugging in software development?

a)

To gather user feedback for future updates and features.

b)

To increase the software's processing speed and efficiency.

c)

The purpose of debugging in software development is to identify and fix bugs to ensure the software operates correctly.

d)

To enhance the aesthetic design of the software interface.

11.

What are unit tests and why are they important?

a)

Unit tests are random tests for software performance, important for user satisfaction.

b)

Unit tests are automated tests for individual components of software, crucial for early bug detection and ensuring code quality.

c)

Unit tests are documentation tools for software features, vital for project management.

d)

Unit tests are manual checks for entire applications, essential for user interface design.

12.

What is an API and how is it used in programming?

a)

An API is a programming language used for web development.

b)

An API is a graphical interface for designing software applications.

c)

An API is a set of rules that allows different software applications to communicate and is used in programming to integrate external functionalities.

d)

An API is a database management tool for storing data.

13.

What does REST stand for in the context of APIs?

a)

Resourceful State Transfer

b)

Representational State Transfer

c)

Representational Static Transfer

d)

Remote State Transfer

14.

What is version control and why is it important?

a)

Version control is a method for creating backups and is not essential for teamwork.

b)

Version control is important because it facilitates collaboration, maintains a history of changes, and allows for easy recovery of previous versions.

c)

Version control tracks only the final version of files and ignores previous changes.

d)

Version control is only useful for large software projects and not for small teams.

15.

Explain the difference between Git and SVN.

a)

SVN is faster than Git for large projects.

b)

Git is distributed; SVN is centralized.

c)

Git uses a single repository; SVN uses multiple repositories.

d)

Git requires a constant internet connection; SVN does not.

16.

What command is used to create a new branch in Git?

a)

git create

b)

git branch

c)

git new-branch

d)

git checkout -b

17.

What is a merge conflict in version control?

a)

A merge conflict occurs when all changes from branches are combined successfully.

b)

A merge conflict happens when a branch is merged without any changes made.

c)

A merge conflict is when one branch is deleted during the merging process.

d)

A merge conflict is a situation in version control where changes from different branches cannot be automatically merged due to conflicting modifications.

18.

How do you revert a commit in Git?

a)

Use 'git revert '

b)

Use 'git reset '

c)

Run 'git checkout '

d)

Execute 'git delete '

19.

What is the purpose of a README file in a project?

a)

To list all contributors to the project.

b)

To provide a detailed technical specification.

c)

To serve as a marketing tool for the project.

d)

The purpose of a README file in a project is to provide essential information and instructions about the project.

20.

What is the significance of code comments?

a)

Code comments replace the need for documentation.

b)

Code comments are only useful for beginners.

c)

Code comments enhance code clarity and maintainability.

d)

Code comments slow down the coding process.

21.

which of the following python code gives output 9?(a=5,b=4)

a)

data = a & b

a = a ^ b

b = data << 1

b)

data = a & b

a = a ^ b

b = data >> 1

c)

data = a ^ b

a = a & b

b = data << 1

d)

data = a >> b

a = a & b

b = a^b

22.

Is python supports multi-threading?

a)
No
b)
Yes
23.

which of the following code will replaces space with a given character in python?

a)

string = "Hello World"
character = "-"
new_string = string.replace(" ", character)
print(new_string)

b)

string = "Hello World"
character = "-"
table = str.maketrans(" ", character)
new_string = string.translate(table)
print(new_string)

c)

Both 1 &2

d)

None

24.

If two lists containing the same elements at different positions are called

(ex: silent and listen)

(a)  

25.


What does URL stand for?

a)

Uniform Resource Locator

b)

Uniform Resource Location

c)

Uniform Reset Locator

d)

Unified Resource Locator

26.
  1. Which of the following is a graph traversal algorithm?

a)

Breadth first search

b)

Depth first search

c)

Dijkstra's algorithm

d)

All of the above

27.

What is the output of the following program?

from math import *

a = 2.13

b = 3.7777

c = -3.12

print(int(a), floor(b), ceil(c), fabs(c))

a)

2 3 -4 3

b)

2 3 -3 3.12

c)

2 4 -3 3

d)

2 3 -4 3.12 

28.

What is the time complexity for checking if an undirected graph with E edges and V vertices is Bipartite, given its adjacency matrix?

a)

O(E)

b)

O(V*V)

c)

O(E*E)

d)

O(V)

29.

An unrestricted use of the "goto" statement is harmful because

a)
It reduces the risk of errors
b)
It improves code readability
c)
It makes debugging easier
d)
It can make the code difficult to understand and maintain.
30.

Which of the following statements are CORRECT?

1) Static allocation of all data areas by a compiler makes it impossible to implement recursion.

2) Automatic garbage collection is essential to implement recursion.

3) Dynamic allocation of activation records is essential to implement recursion.

4) Both heap and stack are essential to implement recursion.

a)

1 and 2 only

b)

2 and 3 only

c)

3 and 4 only

d)

1 and 3 only

31.

Consider the function func shown below:

def func(num):

count = 0

while num:

count += 1

num >>= 1

return count

The value returned by func(435) is _________.

a)
435
b)
0
c)
9
d)
1
32.

A three-member committee has to be formed from a group of 9 people. How many such distinct committees can be formed?

a)
84
b)
63
c)
45
d)
27
33.

Hema's age is 5 years more than twice Hari's age. Suresh's age is 13 years less than 10 times Hari's age. If Suresh is 3 times as old as Hema, how old is Hema?

a)
25
b)
17
c)
30
d)
10
34.

The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity

a)

O(n)

b)

O(m)

c)

O(n+m)

d)

O(nm)

35.

A circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To which node should p point such that both the operations enQueue and deQueue can be performed in constant time?

a)
a node with the largest value
b)
a random node
c)
the first node
d)
the last node
36.

Consider the following function:

def unknown(n):

k = 0

for i in range(n//2, n+1):

j = 2

while j <= n:

k = k + n//2

j = j * 2

return k

The return value of the function is

a)

O((n//2) * n)

b)

O(n2*logn)

c)

O(n * log(n))

d)

O(n * (n//2))

37.

The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of

a)
n
b)
nlogn
c)
n^2
d)
2^n
38.

Which of the following statements is correct regarding the object-oriented programming concept in Python?

a)
  1. Classes are real-world entities while objects are not real

b)
  1. Objects are real-world entities while classes are not real

c)
  1. Both objects and classes are real-world entities

d)
  1. All of the above

39.

What is agg() function?

a)
A function used in pandas for aggregation
b)
A function for filtering data
c)
A function for sorting data
d)
A function for joining tables
40.

what are the types of gready algorithms?

a)

Dijkstra's Algorithm

b)

Prim's Algorithm

c)

Huffman Coding

d)

Fractional Knapsack

41.

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

42.

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.
43.

Expand PEP in python?

a)

Python Extension Protocol

b)
Python Error Prevention
c)

Python Enhancement Proposal

d)
Python Enhancement Program
44.

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

a)

random( )

b)

randint( )

c)

uniform( )

d)

range( )

45.

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
46.

who created python?

(a)  

47.

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.
48.

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
49.

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
50.

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)

51.

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

52.

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

53.

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

54.

what is the correct way to declare pointer in c?

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

int var(*ptr);

d)

int **ptr;

55.

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

56.

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

57.

C supports multithreading?

a)

True

b)

False

58.

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

59.

who is he?

(a)  

60.

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