Online Test for C
- Select worng statement for constructing C variable
A variable name is any combination alphabets, digits or underscoresFirst character in variable must be alphabets and underscoreAny special symbol can be used in variable nameNo commas or blanks are allowed within a variable name
- Find Error/Output in follwing code:
int main() {
char p[] = "%dn";
p[1] = 'c';
printf(p, 65);
int k=40, *a;
a = &k;
(*a)++; k++;
printf("n k=%d",k);
}
c k=40
b k=44
A k=42
a k=40
- Which of the following has compilation error in C?
int n = 32;char ch = 65;float f = (float) 3.2;None of the above
- A zero value is considered to be false and a non-zero value is considered to be true.
TrueFalse
- Every C Program must have one function called?
switch()main()struct()for()
- Find Error/Output in follwing code:
struct
{
int si;
double d;
float cp;
} s;
void
main ()
{
printf ("%d, %d, %d", sizeof (s.si), sizeof (s.d), sizeof (s.cp));
}
6, 10, 8
4, 8, 4
2, 4, 4
2, 8, 8
- Find Error/Output in follwing code:
main() {
int a = 10;
if ((fork ( ) == 0))
a++;
printf ("%dn", a );
}
10 and 11
10
11
11 and 11
- Find Error/Output in follwing code:
int main ()
{
int a = 5;
float b;
printf ("%d", sizeof (++a + b));
printf (" %d", a);
return 0;
}
6 5
5 6
4 5
5 4
- 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
- Find Error/Output in follwing code:
main() {
int i = 2, *j;
j = &i;
printf("%d", i**j*i+*j);
}
Syntax error due to Invalid expression in printf
Print junk value
16
10
Also Exercise
Post Your Question
Social Sharing
Search
Articles
Recently Added Jobs
Rajasthan High Court - Jodhpur Recruitment 2017 for Civil Judges
Last Date: 21 December, 2017
Last Date: 21 December, 2017
WBSEDCL Recruitment - 2017 for Office Executive
Last Date: 16 May, 2017
Last Date: 16 May, 2017
RECRUITMENT OF PROBATIONARY OFFICERS IN STATE BANK OF INDIA
Last Date: 06 March, 2017
Last Date: 06 March, 2017
UPSC Combined Medical Services Examination 2015
Last Date: 10 April, 2015
Last Date: 10 April, 2015
UPSC Engineering Services Examination 2015
Last Date: 10 April, 2015
Last Date: 10 April, 2015