Online Test for C
- The maximum value that an integer constant can have varies from one compiler to another.
TrueFalse
- Find Error/Output in follwing code:
int main ()
{
static int num = 8;
printf ("%d", num = num - 2);
if (num != 0)
main ();
}
8 6 4 2
Infinite output
Invalid because main function can't call itself.
6 4 2 0
- The return type of malloc function is void.
TrueFalse
- Which of the following is NOT a valid Real Constant?
+345.2345 22.220.000564-3.2
- 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
- How to make an infinity loop in C?
loop: ..... goto loop;for(;;) { }while(1) { }All of the above
- The largest element of an array index is called its
Lower boundUpper boundRangeAll of the above
- Find Error/Output in follwing code:
How many times "Placement Question" will print.
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("Placement Question");
}
return 0;
}
Infinite Time
11 Times
0 Time
10 Times
- Which of the following is allowed in a C Arithmetic instruction
[]{}()None of the above
- Find Error/Output in follwing code:
void fn() {
int a = 10;
static int b = 20;
printf("a = %d b = %d", ++a, ++b);
}
int main() {
fn();
fn();
return 0;
}
a = 11 b = 21 a = 11 b = 22
a = 11 b = 21 a = 11 b = 22
a = 11 b = 21 a = 11 b = 22
a = 11 b = 21 a = 11 b = 22
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