Professional Documents
Culture Documents
Quiz of ICp
Quiz of ICp
#include<stdio.h>
main()
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Answer : D
Explanation
Compiler error, semi colons need to appear though the expressions are optional for the
for loop.
Hide Answer
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Hide Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
Answer : C
Explanation
option (a) & (b) are valid. There is no such syntax or provision as in option (c).
Hide Answer
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Show Answer
#include<stdio.h>
main()
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
A - Hello
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Hide Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
A - Near: 1, far: 4, huge: 7
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Hide Answer
Q 7 - What is a pointer?
Answer : C
Explanation
If var is a variable then &var is an address in memory.
Hide Answer
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
char *fgets(char *s, int size, FILE *stream);
Show Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
Hide Answer
#include<stdio.h>
int main()
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100.
Hide Answer
#include<stdio.h>
main()
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Answer : D
Explanation
Compiler error, semi colons need to appear though the expressions are optional for the
for loop.
Hide Answer
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Hide Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
Answer : C
Explanation
option (a) & (b) are valid. There is no such syntax or provision as in option (c).
Hide Answer
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Hide Answer
#include<stdio.h>
main()
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
A - Hello
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Hide Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Hide Answer
Q 7 - What is a pointer?
Answer : C
Explanation
If var is a variable then &var is an address in memory.
Hide Answer
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
Show Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
Hide Answer
#include<stdio.h>
int main()
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
}
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100.
#include<stdio.h>
main()
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Answer : D
Explanation
Compiler error, semi colons need to appear though the expressions are optional for the
for loop.
Hide Answer
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Hide Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
Answer : C
Explanation
option (a) & (b) are valid. There is no such syntax or provision as in option (c).
Hide Answer
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Show Answer
#include<stdio.h>
main()
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
A - Hello
B - Compile error: there is no macro called undef
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Hide Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Hide Answer
Q 7 - What is a pointer?
Answer : C
Explanation
If var is a variable then &var is an address in memory.
Hide Answer
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
Hide Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
Hide Answer
#include<stdio.h>
int main()
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100
#include<stdio.h>
main()
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Answer : D
Explanation
Compiler error, semi colons need to appear though the expressions are optional for the
for loop.
Show Answer
Q 2 - What is the output of the following program?
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Hide Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
Answer : C
Explanation
option (a) & (b) are valid. There is no such syntax or provision as in option (c).
Show Answer
Q 4 - What is the output of the following program?
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Hide Answer
#include<stdio.h>
main()
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
}
A - Hello
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Hide Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Hide Answer
Q 7 - What is a pointer?
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
Hide Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
}
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
Hide Answer
#include<stdio.h>
int main()
{
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100
#include<stdio.h>
main()
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Answer : D
Explanation
Compiler error, semi colons need to appear though the expressions are optional for the
for loop.
Hide Answer
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Show Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Show Answer
#include<stdio.h>
main()
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
A - Hello
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Hide Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Hide Answer
Q 7 - What is a pointer?
Answer : C
Explanation
If var is a variable then &var is an address in memory.
Show Answer
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
Show Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
Hide Answer
int main()
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100.
#include<stdio.h>
main()
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Show Answer
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Hide Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Hide Answer
#include<stdio.h>
main()
{
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
A - Hello
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Show Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Show Answer
Q 7 - What is a pointer?
Answer : C
Explanation
If var is a variable then &var is an address in memory.
Show Answer
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
Hide Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
{
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
Hide Answer
#include<stdio.h>
int main()
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100.
#include<stdio.h>
main()
{
for()printf("Hello");
A - Infinite loop
C - No output
D - Compile error
Answer : D
Explanation
Compiler error, semi colons need to appear though the expressions are optional for the
for loop.
Show Answer
#include<stdio.h>
main()
int i = 1;
while(i++<=5);
printf("%d ",i++);
A-4
B-6
C-26
D-24
Answer : B
Explanation
6, there is an empty statement following while.
Hide Answer
Q 3 - Following is the invalid inclusion of a file to the current program. Identify it.
A - #include <file>
B - #include file
Answer : C
Explanation
option (a) & (b) are valid. There is no such syntax or provision as in option (c).
Show Answer
#include<stdio.h>
main()
fprintf(stdout,"Hello, World!");
A - Hello, World!
B - No output
C - Compile error
D - Runtime error
Answer : A
Explanation
stdout is the identifier declared in the header file stdio.h which is connected to standard
output device (monitor).
Hide Answer
main()
#undef NULL
char *s = "Hello";
while(*s != NULL)
printf("%c", *s++);
A - Hello
Answer : D
Explanation
NULL is equivalent to \0 in value. Statement *s++ prints the character first and
increments the address later.
Show Answer
Q 6 - In Windows & Linux, how many bytes exist for near, far and huge pointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer =
4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer =
4 and huge pointer = 4.
Hide Answer
Q 7 - What is a pointer?
Answer : C
Explanation
If var is a variable then &var is an address in memory.
Show Answer
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the
size of the buffer into which the supplied string will be stored.
A - True
D - False
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are
more safer to use then gets() because gets() doesn't facilitate to detail the length of the
buffer to store the string in and fgets() facilitates to specify a maximum string length.
Hide Answer
Q 9 - Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
A - "ABC"
B - "ACD"
C - "ADF"
D - Return error
Answer : D
Explanation
The syntax of fclose() function is wrong; it should be int fclose(FILE *stream); closes
the stream. Here, fclose(fp, fs, ft); is using separator(,) which returns error by saying
that extra parameter in call to fclose() function.
#include<stdio.h>
int main ()
fp = fopen("ABC", "r");
fs = fopen("ACD", "r");
ft = fopen("ADF", "r");
return 0;
Hide Answer
#include<stdio.h>
int main()
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
A - 100
B-0
C - Print x
D - Return Error
Answer : A
Explanation
Although, integer y = 100; and constant integer x is equal to y. here in the given above
program we have to print the x value, so that it will be 100