WorksheetsC Programming Quiz
Total questions: 25
Worksheet time: 13mins
What is the purpose of the #include directive in a C program?
To include a library file.
To define a library file.
To define a constant.
To start the main function.
An interpreter reads the source code of a program
one line at a time
two lines at a time
complete program in one stroke
None of these
Choose the correct statements from the following:
i) C is an object oriented programming language.
ii) C programs are highly portable on any type of operating system platform.
iii) A flowchart is a visual representation of the sequence of steps for solving a problem.
iv) The role of a compiler is to translate source program statements to decimal codes.
(i) and (ii)
(ii) and (iii)
(i), (ii), and (iii)
(ii), (iii), and (iv)
What will be the output for the given code?
#include
b
Y
Z
d
What will be the output for the given code?
#include
0
1
4
-1
What will be the output for the given code?
#include
2
3
5
1
Predict the output:
#include
8
9
5
10
Predict the output:
#include
65
68
C
D
Guess the output of the given code:
#include
3.5
3.0
3.50
3
What is the output of the given code?
#include<stdio.h>
int main() {
int a = 5, b = 3;
printf("%d", a++ + ++b); return 0; }
8
9
10
11
Which of the following is not a correct expression in C?
a + b * c
a = b = c
(a > b) && (b > c)
a = (b+c) * / d
In C, which function is used for formatted input?
scanf()
printf()
gets()
puts()
Which operator is used to access the address of a variable?
&
*
->
%
Which of the following is a valid variable name in C?
float-rate
int 2value
_count
long double
Which of the following is a valid constant in C?
int a = 10;
const int a = 10;
float x;
keyword const;
Which of the following character sets are used in C?
Alphabets, Digits, Special Symbols, Whitespace
Alphabets only
Digits only
ASCII values only
Which of the following is NOT a C keyword?
int
else
Char
if
Which operator has the highest precedence in C?
* (Multiplication)
++ (Increment)
() (Parentheses)
&& (Logical AND)
What is the size of the float data type in C?
2 bytes
4 bytes
8 bytes
Depends on compiler
What will be the output of the following code?
#include<stdio.h>
int main()
{ int a = 9, b = 2;
printf("%f", (float)a / b); return 0;}
4.5
4
5
4.0
What will be the output of the following code?
#include<stdio.h>
int main(){
int a = 9, b = 3;
printf("%d", a&b);
return 0; }
5
4
1
0
What will be the output of the following code? #include <stdio.h>
int main() {
int a = 10, b = 4;
printf("%d", a^b);
return 0; }
6
14
10
1
What will be the output of the following code?
#include<stdio.h>
int main(){
int a = 10;
printf("%d", a<<2);
return 0; }
10
40
20
15
What will be the output of the following code? #include<stdio.h>
int main(){
int a = 4;
printf("%d", a>>1);
return 0; }
6
4
8
2
What will be the output of the following code? #include <sttdio.h>
int main(){
int x=10, y=5;
printf("%d", x|y );
return 0; }
6
15
5
1
