0% found this document useful (0 votes)
43 views2 pages

C Quiz

Uploaded by

Balaram Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

C Quiz

Uploaded by

Balaram Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

National Institute of Technology Rourkela

Basic Programming (CS1000) Quiz Test -2


Name………………………………………………………………….………………….Roll No.:……………………………

Instructions: Write only the output for the question number 1 to 5 and the remaining questions (no. 6 to 15)
are of MCQ type so tick the correct option.

{
1. #include <stdio.h> for (j = 0; j < 1; )
int main() { {
int i; break;
for(i = 1; i <= 10; i++) { }
if(i % 2 == 0) { printf(“C lab”);
}
printf("%d is even\n", i); }
return 0;
else {printf("%d is odd\n", i);} } }

return 0;} 5. #include <stdio.h>


int main()
2. #include<stdio.h>
{
int main() {
int i = 0;
int i, j;
do
{
for(i = 1; i <= 5; i++) {
printf(“NIT Rourkela”);
for(j = 1; j <= i; j++) {
}
if(j % 2 == 0) {
while(i < 5);
printf("*");
return 0;
} else {
}
printf("#");
}
6. Which of the following is not a logical
}
operator?
printf("\n");
} a. && b. |
c. | |
return 0;
b. d. all of them;
}
7. Which of the following is not an
3. #include<stdio.h>
arithmetic operation?
int main()
a. x *= 20; b. x/=30;
{
int i; c. x%=40; d. x!=10;
for (i = 1; i <= 3; i++)
{ 8. #include<stdio.h>
printf("Hello world"); int main()
} {
int i = 0;
printf("Hi world");
while (i < 3)
return 0;
{
} i++;
4. #include <stdio.h> }
int main() return 0;
{ }
int i, j; How many times the value of i
for (i = 0; i < 3; i++) will be checked?
a. 2; b. 3;
c. 4; d. 1;

9. #include<stdio.h>
int main()
{
for (int i = 1; i != 10; i += 2)
{printf(" X ");
}
return 0;
}
What will be the output?
a. X X X X X;
b. X X…infinite times;
c. X X X X ;
d. X X ;
10. When the condition of the do-
while loop is false, how many
times will it execute the code?
a. 4; b. 3;
c. 1; d. 2 ;

11. Choose the incorrect statement


w.r.t. below variable declarations.
a. int var_9 = 1;
b. int 9_var=1;
c. int _ = 3;
d. all of them.

12. What is the range of values that


can be stored by int datatype in
C?
a. -(2^31) to (2^31)-1;
b. -256 to 255;
c. -(2^63) to (2^63)-1;
d. 0 to (2^31)-1;

13. Which is not a valid keyword in C


language?
a. for
b. while
c. do-while
d. switch

14. What will happen if the loop


condition never become false?
a. It will throw an error
b. it will fall into infinite loop
c. loop will not run
d. none

15. What is the correct syntax to


declare a variable in C?
a. data_type variable_name;
b. variable name data type;
c. data_type =variable_name;
d. none;

You might also like