NEW
Font size
WorksheetsBASIC C QUIZ
Total questions: 15
Worksheet time: 8mins
____________ is a datatype format specifier used to print and scan an integer value.
%f
%d
%c
%s
Which of the following is not a valid C variable name?
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
All keywords in C are in ____________
a) LowerCase letters
b) UpperCase letters
c) CamelCase lettersned
d) None of the mentioned
Which is valid C expression?
a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;
What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
a) 3.75
b) Depends on compiler
c) 24
d) 3
Which of the following declaration is not supported by C?
A.String str;
B. char *str;
C. float str = 3e2;
D. int s[20];
How many characters can a string hold when declared as follows?
char name[20]:
18
19
20
None of the these
What is the output of this program?
#include <stdio.h>
int main()
{
printf("variable! %d", x);
return 0;
}
A. variable! x
B. variable! followed by a junk value
C. Compile time error
D. variable!
Which of the following is an invalid method for input?
a.scanf(“%d%d%d”,&a, &b, &c);
b.scanf(“%d %d %d”, &a, &b, &c);
c.scanf(“Three values are %d %d %d”,&a,&b,&c);
d.none of the mentioned
scanf returns as its value
a.Number of successfully matched and assigned input items
b.Nothing
c.Number of characters properly printed
d.Error
What is the output of this C code?
#include <stdio.h>
void main()
{
int n;
scanf("%d", n);
printf("%d", n);
}
a.Prints the number that was entered
b.Segmentation fault
c.Nothing
d.Varies
What is the output of this C code (when 4 and 5 are entered)?
a.Error
b.4 junkvalue
c.Junkvalue 5
d.4 5
What is the output of the following code snippet?
int main()
{
int sum = 2 + 4 / 2 + 6 * 2;
printf("%d", sum);
return 0;
}
2
15
5
16
What is the correct order of precedence of arithmetic operators from highest to lowest?
%, , /, +, –
-, +, , /, %
%, +, -, , /
+, – , %, , /
Which of the following is not an arithmetic operation?
a*=5;
a/=5;
a!=5;
a%=5;
