NEW
Font size
WorksheetsProgramming Quiz(BCA 3rd)
Total questions: 70
Worksheet time: 35mins
Which of the following is not a valid C keyword?
for
while
loop
if
Which operator is used to get the address of a variable in C?
*
&
%
$
What will be the output of the following code snippet?
int x = 10;
printf("%d", x++);
9
11
10
12
In C, which function is used to read a character from the standard input?
scanf()
getchar()
getch()
gets()
Which of the following is an exit-controlled loop?
for
do-while
while
if
What is the default return type of a function in C if not specified?
float
int
void
char
Which symbol is used to define a preprocessor macro in C?
$
#
&
@
The complexity of linear search is:
O(1)
O(n)
O(log n)
O(n^2)
What will be the output of the pseudocode?
set x = 5
set y = 10
print x + y * 2
30
25
20
15
Which of the following is used for dynamic memory allocation in C?
malloc()
sizeof()
realloc()
calloc()
In C++, which keyword is used to create an object?
function
define
class
new
Which of the following concepts means wrapping data and code together?
Inheritance
Abstraction
Polymorphism
Encapsulation
What is the output of the pseudocode?
set a = 4
set b = 3
if a > b then print a else print b
4
3
7
None
Which operator is used to access members of a structure using a pointer?
.
->
&
*
Which function is used to find the length of a string in C?
length()
count()
strlen()
size()
What is the size of an integer in C (typically on a 32-bit system)?
8 bytes
4 bytes
2 bytes
1 byte
What will be the output of the following?
printf ("%d", 5 != 5);
0
1
Error
5
What is the result of the expression 5 + 2 * 3?
21
11
7
15
Which one is a loop control structure?
break
continue
for
return
Which of the following is not a storage class in C?
auto
static
float
register
What is the output of:
int a = 10, b = 5;
printf("%d", a > b ? a : b);
5
10
Error
0
Which of the following is not a feature of Object Oriented Programming?
Encapsulation
Inheritance
Recursion
Polymorphism
Which of these is used to define a class in C++?
define
struct
class
object
What does ADT stand for in data structures?
Abstract Data Tree
Array Defined Type
Abstract Data Type
Algorithm Defined Type
A binary tree is a tree in which each node has at most:
3 children
2 children
1 child
4 children
The best case complexity of linear search is:
O(n)
O(log n)
O(n^2)
O(1)
Which keyword is used to derive a class in C++?
extends
implements
inherits
public
Which data structure works on the principle of LIFO?
Queue
Stack
Array
Linked List
What is the full form of OOP?
Object Oriented Principle
Object Oriented Programming
Open Object Processing
Original Object Programming
Which one of these is not a C++ access specifier?
public
private
secure
protected
Which algorithm is used in binary search?
Divide and conquer
Brute force
Greedy
Backtracking
In C, a pointer variable stores:
An integer
A float
The address of another variable
The size of a variable
What does the 'continue' statement do in a loop?
Stops the loop
Skips the current iteration
Exits the program
Restarts the loop
Which of the following is used to terminate a C statement?
.
,
;
:
What will be the result of `5 % 2`?
2
1
0
5
How is an array indexed in C?
1 to n
0 to n
0 to n-1
-1 to n
Which of the following is used to allocate memory in C++?
malloc
allocate
new
create
Which keyword is used to declare an abstract class in C++?
abstract
virtual
class
static
What is the time complexity of binary search?
O(n)
O(n log n)
O(log n)
O(n^2)
Which of the following is not a type of constructor in C++?
Default constructor
Copy constructor
Inline constructor
Parameterized constructor
Which among these is not a valid loop in C?
do-while
for
while
repeat-until
What is the output of:
int a = 3;
a += 2;
printf("%d", a);
3
5
2
6
Which of the following is a conditional control statement?
for
if
while
do-while
What does the following declare?
int *ptr;
ptr is an integer
ptr is a pointer to an integer
ptr is an array
ptr is a constant
The address-of operator in C is:
*
&
^
@
What is used to define a constant in C?
#define
const
Both A and B
static
Stack overflow occurs when:
Stack is full
Stack is empty
Memory leaks
Stack is reset
What is the result of 2 << 1 in C?
4
2
1
3
Destructor in C++ is preceded with:
#
~
!
$
C language was developed by:
Bjarne Stroustrup
Dennis Ritchie
James Gosling
Ken Thompson
A linked list is a:
Static data structure
Dynamic data structure
Constant data structure
None of the above
The size of a pointer in C (32-bit system) is:
4 bytes
2 bytes
8 bytes
1 byte
When is the copy constructor invoked?
On object deletion
On object initialization with another object
On object creation
On class definition
Function overloading is a type of:
Inheritance
Encapsulation
Compile-time polymorphism
Run-time polymorphism
Which sorting algorithm is best for nearly sorted lists?
Bubble sort
Selection sort
Insertion sort
Quick sort
A queue follows which order?
LIFO
FILO
FIFO
Random
Recursion uses:
Loop
Stack
Queue
Heap
Q58. Which C++ operator cannot be overloaded?
+
\ [ ]
::
=
Q59. In a stack, what happens when you push an item?
It removes the top
It removes the top
Adds to the top
Deletes from bottom
Q60. Destructor is called:
When object is created
When class is defined
When object is destroyed
When program starts
Q61. What is used to stop a loop in C?
stop
return
break
exit
Q62. Which of these is not a loop?
do
while
switch
for
Q63. Class is a:
Instance
Template
Function
Constructor
Q64. What does the strcmp() function return when strings are equal?
1
-1
0
NULL
Q65. Which of these defines function polymorphism?
Same function name, different parameters
Different return types
Function inside function
Static function
Q66. What is a dangling pointer?
Pointer not pointing anywhere
Pointer pointing to freed memory
NULL pointer
Unused pointer
Q67. A function that calls itself is called:
Recursive
Abstract
Inline
Overloaded
Q68. Constructor has:
Same name as class
Different name
return type
static
Q69. Sizeof(char) in C is:
2
4
1
8
Q70. C++ is a:
Functional language
Procedural language
Object-Oriented language
Scripting language
