C Programming 2
Questions Result & StatisticsQuiz-summary
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
Questions
Instruction:
- Total number of questions : 20
- Time allotted : 25 minutes.
- Each question carry 1 mark, no negative marks.
- Click the “Finish quiz” button given in bottom of this page to submit your answer.
- Test will be submitted automatically if the time expired.
- Don’t refresh the page.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
Marks : 0 of 20 questions answered correctly | ||
Total number of questions | : | 20 |
Number of currect answered | : | 0 |
Your time | : |
|
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thank you for submitting online test!
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
1 pointsCorrectAnswer : B
No Explanation
IncorrectAnswer : B
No Explanation
-
Question 2 of 20
2. Question
1 points.
What is the output of this C code?
#include<stdio.h>
int main()
{
printf(“nn /n/n nn/n”);
return 0;
}
CorrectAnswer : B
No Explanation
IncorrectAnswer : B
No Explanation
-
Question 3 of 20
3. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
printf(“C programming %s”, “Class by\n%s Sanfoundry”, “WOW”);
}
CorrectAnswer : C
No Explanation
IncorrectAnswer : C
No Explanation
-
Question 4 of 20
4. Question
1 points.
What is the output of this C code?
#include <stdio.h>
#define a 10
int main()
{
const int a = 5;
printf(“a = %d\n”, a);
}
CorrectAnswer : C
Explanation : The #define substitutes a with 10 leaving no identifier and hence compilation error.
IncorrectAnswer : C
Explanation : The #define substitutes a with 10 leaving no identifier and hence compilation error.
-
Question 5 of 20
5. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
int var = 010;
printf(“%d”, var);
}
CorrectAnswer : B
Explanation : 010 is octal representation of 8.
IncorrectAnswer : B
Explanation : 010 is octal representation of 8.
-
Question 6 of 20
6. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
const int p;
p = 4;
printf(“p is %d”, p);
return 0;
}
CorrectAnswer : B
No Explanation
IncorrectAnswer : B
No Explanation
-
Question 7 of 20
7. Question
1 points.
Comment on the output of this C code?
#include <stdio.h>
void main()
{
int const k = 5;
k++;
printf(“k is %d”, k);
}
CorrectAnswer : D
No Explanation
IncorrectAnswer : D
No Explanation
-
Question 8 of 20
8. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
int i = -3;
int k = i % 2;
printf(“%d\n”, k);
}
CorrectAnswer : B
No Explanation
IncorrectAnswer : B
No Explanation
-
Question 9 of 20
9. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 5;
i = i / 3;
printf(“%d\n”, i);
return 0;
}
CorrectAnswer : B
No Explanation
IncorrectAnswer : B
No Explanation
-
Question 10 of 20
10. Question
1 points.
What is the output of this C code?
#include <stdio.h>
void main()
{
int x = 5.3 % 2;
printf(“Value of x is %d”, x);
}
CorrectAnswer : D
No Explanation
IncorrectAnswer : D
No Explanation
-
Question 11 of 20
11. Question
1 pointsCorrectAnswer : A
No Explanation
IncorrectAnswer : A
No Explanation
-
Question 12 of 20
12. Question
1 pointsCorrectAnswer : C
No Explanation
IncorrectAnswer : C
No Explanation
-
Question 13 of 20
13. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
int a = 10;
double b = 5.6;
int c;
c = a + b;
printf(“%d”, c);
}
CorrectAnswer : A
No Explanation
IncorrectAnswer : A
No Explanation
-
Question 14 of 20
14. Question
1 points.
What is the output of this C code?
#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = a == (b + c);
printf(“%d”, d);
}
CorrectAnswer : B
No Explanation
IncorrectAnswer : B
No Explanation
-
Question 15 of 20
15. Question
1 points.
What is the output of the following code:
#include<stdio.h>
int
main()
{
int
x=40;
{
int
x=20;
printf
(
"%d"
,x);
}
printf
(
"%d"
,x);
return
0;
}
CorrectAnswer : BExplanation : The variable declared inside the inner block replaces the x declared in the outer block,hence it prints 20 at 1st printf.When the inner block ends, the scope of inner x also endsand hence the value of x becomes 40 in the outer block.IncorrectAnswer : BExplanation : The variable declared inside the inner block replaces the x declared in the outer block,hence it prints 20 at 1st printf.When the inner block ends, the scope of inner x also endsand hence the value of x becomes 40 in the outer block. -
Question 16 of 20
16. Question
1 points.
What is the output of the following program:
void
main( )
{
int
i = 2, j = 3, k, l ;
float
a, b ;
k = i / j * j ;
l = j / i * i ;
a = i / j * j ;
b = j / i * i ;
printf
(
"%d %d %f %f"
, k, l, a, b ) ;
}
CorrectAnswer : D
Explanation : The Float is printed with decimal followed by 6 zeros.
IncorrectAnswer : D
Explanation : The Float is printed with decimal followed by 6 zeros.
-
Question 17 of 20
17. Question
1 points.
What is the output of:
main( )
{
int
a, b ;
a = -3 - - 3 ;
b = -3 - - ( - 3 ) ;
printf
(
"a = %d b = %d"
, a, b ) ;
}
CorrectAnswer : CExplanation : -3 – -3= -3 + 3 = 0-3 –(-3)= -3 – 3 = -6IncorrectAnswer : CExplanation : -3 – -3= -3 + 3 = 0-3 –(-3)= -3 – 3 = -6 -
Question 18 of 20
18. Question
1 pointsCorrectAnswer is : AExplanation : A character variable is of 1 byte lengthand can store just 1 character at a timeIncorrectAnswer is : AExplanation : A character variable is of 1 byte lengthand can store just 1 character at a time -
Question 19 of 20
19. Question
1 points.
What is the output of the following program?
#include<stdio.h>
void
main()
{
printf
(
"%d"
,
sizeof
(5.2));
}
CorrectAnswer : CExplanation : The default type for decimal constants is double and not float.IncorrectAnswer : CExplanation : The default type for decimal constants is double and not float. -
Question 20 of 20
20. Question
1 pointsCorrectAnswer : BExplanation : The ASCII value of a character constant is stored in a character variable ch.IncorrectAnswer : BExplanation : The ASCII value of a character constant is stored in a character variable ch.