wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming Quiz(BCA 3rd)

Total questions: 70

Worksheet time: 35mins

Name
Class
Date
1.

Which of the following is not a valid C keyword?

a)

for

b)

while

c)

loop

d)

if

2.

Which operator is used to get the address of a variable in C?

a)

*

b)

&

c)

%

d)

$

3.

What will be the output of the following code snippet?

int x = 10;

printf("%d", x++);

a)

9

b)

11

c)

10

d)

12

4.

In C, which function is used to read a character from the standard input?

a)

scanf()

b)

getchar()

c)

getch()

d)

gets()

5.

Which of the following is an exit-controlled loop?

a)

for

b)

do-while

c)

while

d)

if

6.

What is the default return type of a function in C if not specified?

a)

float

b)

int

c)

void

d)

char

7.

Which symbol is used to define a preprocessor macro in C?

a)

$

b)

#

c)

&

d)

@

8.

The complexity of linear search is:

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n^2)

9.

What will be the output of the pseudocode?

set x = 5

set y = 10

print x + y * 2

a)

30

b)

25

c)

20

d)

15

10.

Which of the following is used for dynamic memory allocation in C?

a)

malloc()

b)

sizeof()

c)

realloc()

d)

calloc()

11.

In C++, which keyword is used to create an object?

a)

function

b)

define

c)

class

d)

new

12.

Which of the following concepts means wrapping data and code together?

a)

Inheritance

b)

Abstraction

c)

Polymorphism

d)

Encapsulation

13.

What is the output of the pseudocode?

set a = 4

set b = 3

if a > b then print a else print b

a)

4

b)

3

c)

7

d)

None

14.

Which operator is used to access members of a structure using a pointer?

a)

.

b)

->

c)

&

d)

*

15.

Which function is used to find the length of a string in C?

a)

length()

b)

count()

c)

strlen()

d)

size()

16.

What is the size of an integer in C (typically on a 32-bit system)?

a)

8 bytes

b)

4 bytes

c)

2 bytes

d)

1 byte

17.

What will be the output of the following?

printf ("%d", 5 != 5);

a)

0

b)

1

c)

Error

d)

5

18.

What is the result of the expression 5 + 2 * 3?

a)

21

b)

11

c)

7

d)

15

19.

Which one is a loop control structure?

a)

break

b)

continue

c)

for

d)

return

20.

Which of the following is not a storage class in C?

a)

auto

b)

static

c)

float

d)

register

21.

What is the output of:

int a = 10, b = 5;

printf("%d", a > b ? a : b);

a)

5

b)

10

c)

Error

d)

0

22.

Which of the following is not a feature of Object Oriented Programming?

a)

Encapsulation

b)

Inheritance

c)

Recursion

d)

Polymorphism

23.

Which of these is used to define a class in C++?

a)

define

b)

struct

c)

class

d)

object

24.

What does ADT stand for in data structures?

a)

Abstract Data Tree

b)

Array Defined Type

c)

Abstract Data Type

d)

Algorithm Defined Type

25.

A binary tree is a tree in which each node has at most:

a)

3 children

b)

2 children

c)

1 child

d)

4 children

26.

The best case complexity of linear search is:

a)

O(n)

b)

O(log n)

c)

O(n^2)

d)

O(1)

27.

Which keyword is used to derive a class in C++?

a)

extends

b)

implements

c)

inherits

d)

public

28.

Which data structure works on the principle of LIFO?

a)

Queue

b)

Stack

c)

Array

d)

Linked List

29.

What is the full form of OOP?

a)

Object Oriented Principle

b)

Object Oriented Programming

c)

Open Object Processing

d)

Original Object Programming

30.

Which one of these is not a C++ access specifier?

a)

public

b)

private

c)

secure

d)

protected

31.

Which algorithm is used in binary search?

a)

Divide and conquer

b)

Brute force

c)

Greedy

d)

Backtracking

32.

In C, a pointer variable stores:

a)

An integer

b)

A float

c)

The address of another variable

d)

The size of a variable

33.

What does the 'continue' statement do in a loop?

a)

Stops the loop

b)

Skips the current iteration

c)

Exits the program

d)

Restarts the loop

34.

Which of the following is used to terminate a C statement?

a)

.

b)

,

c)

;

d)

:

35.

What will be the result of `5 % 2`?

a)

2

b)

1

c)

0

d)

5

36.

How is an array indexed in C?

a)

1 to n

b)

0 to n

c)

0 to n-1

d)

-1 to n

37.

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

a)

malloc

b)

allocate

c)

new

d)

create

38.

Which keyword is used to declare an abstract class in C++?

a)

abstract

b)

virtual

c)

class

d)

static

39.

What is the time complexity of binary search?

a)

O(n)

b)

O(n log n)

c)

O(log n)

d)

O(n^2)

40.

Which of the following is not a type of constructor in C++?

a)

Default constructor

b)

Copy constructor

c)

Inline constructor

d)

Parameterized constructor

41.

Which among these is not a valid loop in C?

a)

do-while

b)

for

c)

while

d)

repeat-until

42.

What is the output of:

int a = 3;

a += 2;

printf("%d", a);

a)

3

b)

5

c)

2

d)

6

43.

Which of the following is a conditional control statement?

a)

for

b)

if

c)

while

d)

do-while

44.

What does the following declare?

int *ptr;

a)

ptr is an integer

b)

ptr is a pointer to an integer

c)

ptr is an array

d)

ptr is a constant

45.

The address-of operator in C is:

a)

*

b)

&

c)

^

d)

@

46.

What is used to define a constant in C?

a)

#define

b)

const

c)

Both A and B

d)

static

47.

Stack overflow occurs when:

a)

Stack is full

b)

Stack is empty

c)

Memory leaks

d)

Stack is reset

48.

What is the result of 2 << 1 in C?

a)

4

b)

2

c)

1

d)

3

49.

Destructor in C++ is preceded with:

a)

#

b)

~

c)

!

d)

$

50.

C language was developed by:

a)

Bjarne Stroustrup

b)

Dennis Ritchie

c)

James Gosling

d)

Ken Thompson

51.

A linked list is a:

a)

Static data structure

b)

Dynamic data structure

c)

Constant data structure

d)

None of the above

52.

The size of a pointer in C (32-bit system) is:

a)

4 bytes

b)

2 bytes

c)

8 bytes

d)

1 byte

53.

When is the copy constructor invoked?

a)

On object deletion

b)

On object initialization with another object

c)

On object creation

d)

On class definition

54.

Function overloading is a type of:

a)

Inheritance

b)

Encapsulation

c)

Compile-time polymorphism

d)

Run-time polymorphism

55.

Which sorting algorithm is best for nearly sorted lists?

a)

Bubble sort

b)

Selection sort

c)

Insertion sort

d)

Quick sort

56.

A queue follows which order?

a)

LIFO

b)

FILO

c)

FIFO

d)

Random

57.

Recursion uses:

a)

Loop

b)

Stack

c)

Queue

d)

Heap

58.

Q58. Which C++ operator cannot be overloaded?

a)

+

b)

\ [ ]

c)

::

d)

=

59.

Q59. In a stack, what happens when you push an item?

a)

It removes the top

b)

It removes the top

c)

Adds to the top

d)

Deletes from bottom

60.

Q60. Destructor is called:

a)

When object is created

b)

When class is defined

c)

When object is destroyed

d)

When program starts

61.

Q61. What is used to stop a loop in C?

a)

stop

b)

return

c)

break

d)

exit

62.

Q62. Which of these is not a loop?

a)

do

b)

while

c)

switch

d)

for

63.

Q63. Class is a:

a)

Instance

b)

Template

c)

Function

d)

Constructor

64.

Q64. What does the strcmp() function return when strings are equal?

a)

1

b)

-1

c)

0

d)

NULL

65.

Q65. Which of these defines function polymorphism?

a)

Same function name, different parameters

b)

Different return types

c)

Function inside function

d)

Static function

66.

Q66. What is a dangling pointer?

a)

Pointer not pointing anywhere

b)

Pointer pointing to freed memory

c)

NULL pointer

d)

Unused pointer

67.

Q67. A function that calls itself is called:

a)

Recursive

b)

Abstract

c)

Inline

d)

Overloaded

68.

Q68. Constructor has:

a)

Same name as class

b)

Different name

c)

return type

d)

static

69.

Q69. Sizeof(char) in C is:

a)

2

b)

4

c)

1

d)

8

70.

Q70. C++ is a:

a)

Functional language

b)

Procedural language

c)

Object-Oriented language

d)

Scripting language