NEW
Font size
WorksheetsQuiz on C Fundamentals for CSE & CST
Total questions: 20
Worksheet time: 10mins
Guess the output?
3
-4
4
Compile error
What is the output of following program?
0
1
2
3
Which of the following operator can be used to access value at address stored in a pointer variable?
*
&
->
.
To print a double value, which format specifier can be used?
%l
%ld
%d
%lf
What is the output of the following code snippet?
Hi
HelloHi
Compile error
Compiler warning
What is the output of the below code snippet?
Infinite loop
Prints “Hello” once
No output
Compile error
What is the output of the below code snippet?
Infinite loop
Prints “Hello” once
No output
Compile error
int x=~1; What is the value of 'x'?
1
-1
2
-2
What is the output of the following code snippet?
15
Garbage value
Run-time error
Compile-time error
What is the output of the following program?
Hello
hi
Hellohi
Compile error
What will be printed for the below statement?
0
1
-1
Invalid use of strcmp() function
What is the output of the following program?
0
1
2
Compile error
What is the size of ‘int’ data type?
2
4
8
Compiler dependent
What is the output of the following program?
Hi
Hello
HiHello
Compile error
What is the output of the following program?
1
2
Compile error
Run-time error
What is the output of the following program?
1
2
3
Compile error
Predict the output of the following code.
1
2
3
Compile error
The reason for using pointers in a C program.
Pointers allow different functions to work on the same data
When we pass structures as argument, the complete copy of the structure can be avoided.
Pointers enable implementation of non-linear data structures
All of the above
Assume int is 2 bytes, char is 1 byte and float is 4 bytes. Also, assume that the pointer size is 4 bytes. Predict the output.
1 2 4
1 4 4
4 4 4
None of the above
What will be the output produced by the following C code?
0
1
-1
Compile error
