wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Pre-Assessment- C,C++, Data Structure & SQL_10th June 24

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is the correct syntax to include a header file in a C program?

a)

#header <stdio.h>

b)

#include stdio.h

c)

#include <stdio.h>

d)

#include "stdio.h"

2.

Which of the following statements is correct about a do-while loop in C?

a)

The loop condition is checked before the loop is executed.

b)

The loop condition is checked after the loop is executed.

c)

It is similar to a for loop.

d)

It can only be used to iterate through arrays.

3.

Which of the following correctly declares and initializes an array of integers in C?

a)

int arr = {1, 2, 3};

b)

int arr[] = {1, 2, 3};

c)

int arr[3] = 1, 2, 3;

d)

int arr(3) = {1, 2, 3};

4.

Which of the following correctly defines a structure in C?

a)

struct { int a; float b; }

b)

struct myStruct { int a; float b; };

c)

structure myStruct { int a; float b; }

d)

struct { int a; float b; } myStruct;

5.

What is the correct mode to open a file for reading and writing in C, where the file is created if it does not exist?

a)

"r+"

b)

"w+"

c)

"a+"

d)

"rw"

6.

Which of the following functions is used to allocate memory dynamically in C?

a)

alloc()

b)

malloc()

c)

calloc()

d)

memalloc()

7.

What is the correct way to free dynamically allocated memory in C?

a)

release(ptr);

b)

free(ptr);

c)

delete(ptr);

d)

dealloc(ptr);

8.

Which of the following is NOT a pillar of Object-Oriented Programming?

a)

Encapsulation

b)

Inheritance

c)

Compilation

d)

Polymorphism

9.

Which of the following statements is true about encapsulation in C++?

a)

Encapsulation is the process of inheriting properties from a base class.

b)

Encapsulation is the technique used to achieve polymorphism.

c)

Encapsulation binds together the data and functions that manipulate the data.

d)

Encapsulation allows one class to access the private members of another class.

10.

Which of the following operators cannot be overloaded in C++?

a)

+

b)

=

c)

::

d)

++

11.

What is the correct syntax for catching all exceptions in C++?

a)

catch(...)

b)

catch(Exception e)

c)

catch(*)

d)

catch_all()

12.

Which of the following is not a component of the Standard Template Library (STL) in C++?

a)

Algorithms

b)

Containers

c)

. Iterators

d)

Threads

13.

Which of the following data structures uses LIFO (Last In First Out) order?

a)

Queue

b)

Stack

c)

Array

d)

Linked List

14.

What is the time complexity of searching for an element in an unsorted array?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

15.

Which of the following statements is true about Binary Search Trees (BST)?

a)

Every node has at most two children.

b)

The left subtree contains only nodes with values greater than the parent node.

c)

The right subtree contains only nodes with values less than the parent node.

d)

It is a complete binary tree.

16.

In an ER diagram, which of the following represents a relationship?

a)

Ellipse

b)

Rectangle

c)

Diamond

d)

Line

17.

Which SQL statement is used to retrieve data from a database?

a)

GET

b)

FETCH

c)

SELECT

d)

RETRIEVE

18.

Which type of join returns all rows when there is a match in either left or right table?

a)

INNER JOIN

b)

LEFT JOIN

c)

RIGHT JOIN

d)

FULL OUTER JOIN

19.

Is images and videos being the example of the Structured data?

a)

Yes

b)

No

20.

A _____ is a place where we can used to store huge amounts of structured data from different databases in a one place.

a)

database

b)

data lake

c)

cloud

d)

data warehouse