WorksheetsC-Volution (Hard)
Total questions: 10
Worksheet time: 10mins
What is the output of the following code?
#include
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
1 2 3 4 5 2 3 4 5 3 4 5 4 5 5
What is the output of the following code?
#include
***** **** *** ** *
* ** *** **** *****
***** **** *** ** *
* ** *** **** *****
What is the error in the following code?
#include
Missing #include directive.
Dereferencing an uninitialized pointer.
Incorrect format specifier in printf().
No error.
What does the following code snippet do? #define SQUARE(x) x * x
Defines a function named SQUARE.
Defines a macro named SQUARE.
Declares a variable named SQUARE.
Includes a header file named SQUARE.
What is the output of the following code?
#include
* * * * * * *
**** **** **** ****
* * * *
Nothing will be printed.
What is the correct way to dynamically allocate memory for an array of 10 integers?
int *arr = malloc(10 * sizeof(int));
int *arr = calloc(10, sizeof(int));
int *arr = new int[10];
Both (a) and (b)
What is the output of the following code?
#include
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4
Infinite loop
What is the output of the following code?
#include
***** * * * * * * *****
* * * * * * * * * * * * * * * *
***** ***** ***** ***** *****
* ** *** **** *****
What is the output of the following code?
#include
A A B A B C A B C D
A B C D E F G H I J
A B B C C C D D D D
A A B A B C A B C D
What is the output of the following code?
#include
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
1 2 3 4 5 2 3 4 5 3 4 5 4 5 5
