Font size
WorksheetsAI-Quiz2
Total questions: 80
Worksheet time: 1hrs 5mins
/
%
bitwise operator
*
-1 1
1 -1
-1 -1
1 1
14
11
12
13
10 5 3 4
10 5 4 4
10 5 3 3
10 5 4 3
Find The Output
int a = 3;
printf("%d %d %d %d", a , a++ ,a, a);
(a)
int a = 10;
int b = a++ + ++a;
printf("%d %d %d %d",b , a++ ,a, ++a);
(a)
int a = 3;
printf("%d %d %d %d",++a , a++ ,a, --a);
(a)
(a)
14 8
3 8
3 7
4 8
50 10 24 50
50 13 24 50
50 13 24 13
50 13 11 13
(a)
(a)
(a)
44
55
1510
error
4
40
1
10
20
10
9
1
Hello
World
1
0
4 4
4 1
1 4
1 1
(a)
-65535 -65535
65535 -65536
-65535 65535
65535 65535
Operator % in C Language is called.?
Percentage Operator
Quotient Operator
Modulus
Division
Which of the following is not logical operator?
&
||
!
&&
Which operator performs operations on data in Binary Level.
Logical operator
Bitwise operator
Conditional operator
None
#include <stdio.h>
int main()
{
int a=10, b;
b=a%3;
printf("%d",b);
return 0;
}
0
2
4
1
int a = 3.5 + 4.5;
a = 0
a = 7
a = 8.0
a = 8
The size of character variable in c
2 byte
5 byte
8 byte
1 byte
#include <stdio.h>
int main(){
int x= 5*9/3+9;
printf("%d",x);
return 0;
}
8
24
25
None
#include <stdio.h>
int main(){
int x= 5%2 *3/2;
printf("%d",x);
return 0;
}
1
2
3
99
Pickup odd one out
a=a+1;
a+=1
a++
a=+1
int main()
{
float c = 3.5 + 4.5;
printf("%f", c);
return 0;
}
7
8
9
8.000000
Which of the following correctly shows the hierarchy of arithmetic operations in C?
/ + * -
* - / +
+ - / *
/ * + -
Which of the following is the correct usage of conditional operators used in C?
a>b ? c=30 : c=40;
a>b ? c=30;
max = a>b ? a>c?a:c:b>c?b:c
return (a>b)?(a:b)
What is a format specifier in C language.?
A format Specifier tells compiler to treat a variable value is predefined way.
Different format specifiers are used to print different type of data.
Format specifiers are used to write data to files in a formatted way.
All the above
Which among the following is the odd one out?
printf
fprintf
putchar
scanf
For a typical program, the input is taken using _________
scanf
Files
Command-line
All of the mentioned
What is the value of EOF?
-1
1
0
10
What is the use of getchar()?
The next input character each time it is called
EOF when it encounters end of file
The next input character each time it is called EOF when it encounters end of file
None of the mentioned
What is the return value of putchar()?
The character written
EOF if an error occurs
Nothing
Both character written & EOF if an error occurs
Choose a C Formatted Input Output function below.
printf(), scanf()
sprintf(), sscanf()
fprintf(), fscanf()
All the above
Choose a correct C statement.?
SCANF can accept all types of data from keyboard including numbers and strings
GETS can accept only one String of any length and any number of words. GETCHAR can accept only one character constant from keyboard.
SCANF can accept only single word Strings
All the above
Constants in C can be divided into categories ?
3
6
2
4
______not a primary constant.
Integer Constant
Real constant
Character constant
Enum constant
What is constant?
Constants have fixed values that do not change during the execution of a program
Constants have fixed values that change during the execution of a program
Constants have unknown values that may be change during the execution of a program
None of the above
Which is the right way to declare constant in C?
int constant var =10;
int const var = 10;
const int var = 10;
B & C Both
Which operators are known as Ternary Operator?
::, ?
?, :
?, ;;
None of the above
What is the default return-type of getchar()?
char
int
char *
reading character doesn’t require a return-type
What is the return value of putchar()?
The character written
EOF if an error occurs
Nothing
Both character written & EOF if an error occurs
Which of the following is example of relational operator in C language?
<
>
!=
all the above
!= is the example of ____________________ operator.
Relational
Logical
Assignment
Conditional
Choose a C Formatted Input Output function below.
printf(), scanf()
sprintf(), sscanf()
fprintf(), fscanf()
All the above
What is the output of the code,
printf("%06.2f", 6.66666);
What is the output of the code,
printf("%6.3f", 66666.66666);
What is the output of the code,
printf("%.3s", "hellohere");
What is the output of the statement?
printf("marks \\ total");
What will be the output for the following program?
void main()
{
int a=300,b,c;
if(a>=400)
b=300;
c=200;
printf(“\n%d ,%d”,b,c);
}
What will be the output for the following program?
void main()
{
int a=500,b,c;
if(a>=400)
b=300;
c=200;
printf(“\n%d ,%d”,b,c);
}
What will be the output for the following program?void main()
{
int i=65;
char j=’A’;
if(i==j)
printf(“BETA”);
else
printf(“Bye”);
}
What will be the output for the following program?
void main()
{
int i=5;
if (i = 4)
printf(“The value of i is 5”);
else
printf(“The value of i is not 5”);
}
