NEW
Font size
WorksheetsProgramming in C – Quiz Questions
Total questions: 15
Worksheet time: 8mins
The name of an array in C represents:
The last element address
A variable
The base address of the array
The size of the array
A string in C always ends with:
\n
EOF
NULL
\0
Which operator is used to access the value pointed by a pointer?
&
*
@
->
Bubble sort works by repeatedly:
Selecting the minimum element
Dividing the array
Comparing adjacent elements and swapping
Inserting elements at correct position
Which of the following is the correct form of a function?
function fun()
def fun()
void fun()
fun():void
Which arguments are passed to main()?
arg and argv
argc and argv
args and argc
argv and env
What will be printed by the following recursive function?
int fun(int n)
{
if(n == 0)
return 0;
else
return n + fun(n-1);
}
int main()
{
printf("%d", fun(3));
}
3
5
6
9
What will be the output of the following program? void fun(int *x) { *x = *x + 5; } int main() { int a = 10; fun(&a); printf("%d", a); }
10
15
5
Garbage value
Which function is used to release dynamically allocated memory?
malloc()
calloc()
realloc()
free()
A structure in C is used to:
Store similar data types
Store different data types together
Increase execution speed
Allocate dynamic memory
Which operator is used to access structure members using pointer?
.
:
*
->
In a union, memory allocated is equal to:
Sum of all members
Average of members
Largest member
Smallest member
Bit-fields are used to:
Speed up execution
Store floating values
Save memory
Increase precision
typedef is used to:
Create new variables
Rename existing data types
Allocate memory
Define constants
Which function is used to release dynamically allocated memory?
malloc()
calloc()
realloc()
free()
