Output Questions Set 6
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Output Questions
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
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
1 points#include<stdio.h>
int main()
{
int a = printf (“rajeshshuklacatalyst.in”);
printf(“%d”, a);
return 0;
}Correct
Hint:
printf() prints and returns the number of characters it has printed that is why its output is rajeshshuklacatalyst.in23, 23 is returned by printf() functionIncorrect
Hint:
printf() prints and returns the number of characters it has printed that is why its output is rajeshshuklacatalyst.in23, 23 is returned by printf() function -
Question 2 of 10
2. Question
1 pointsWhat should be the output:
int main()
{
int a = 10/3;
printf(“%d”,a);return 0;
}Correct
Hint:
integer division ( int/ int ) is int only hence instead of printing 3.33 it will print 3 only. Float part is discarded in such cases.Incorrect
Hint:
integer division ( int/ int ) is int only hence instead of printing 3.33 it will print 3 only. Float part is discarded in such cases. -
Question 3 of 10
3. Question
1 pointsWhich of the following is executed by Preprocess?
* #include<stdio.h>
* return 0
* void main(int argc , char ** argv)
* return(1)Correct
Hint:
statements starting with # symbol are always processed by pre-processorIncorrect
Hint:
statements starting with # symbol are always processed by pre-processor -
Question 4 of 10
4. Question
1 pointsWhat will be the output?
int main()
{
int a = 10.5;
printf(“%d”,a);
return 0;
}Correct
Hint:
compiler will convert float values to integer value after seeing %d so instead of printing 10.5 it will print it integer value i.e 10Incorrect
Hint:
compiler will convert float values to integer value after seeing %d so instead of printing 10.5 it will print it integer value i.e 10 -
Question 5 of 10
5. Question
1 pointsWhat will be the output?
int main()
{
int _ = 10;
int __ = 20;
int ___ = _ + __;
printf(“__%d”,___);
return 0;
}Correct
Hint:
multiple underscore ie. _ can be used to create varialbes.Incorrect
Hint:
multiple underscore ie. _ can be used to create varialbes. -
Question 6 of 10
6. Question
1 pointsWhat will be the output?
int main()
{
int a = 5;
int b = 10;
int c = a+b;
printf(“%i”,c);
}Correct
Hint:
%i is also used to printf numberic values in C. %d and %i both solve the same purpose.Incorrect
Hint:
%i is also used to printf numberic values in C. %d and %i both solve the same purpose. -
Question 7 of 10
7. Question
1 pointsint main()
{
int a = 320;
char *ptr;
ptr =( char *)&a;
printf(“%d”,*ptr);
return 0;
}Correct
Hint:
To understand it you have to convert 320 to binary form which is 101000000, (9 digits) Now code is typecasting this value to char*, which takes 8 bits; so from the 9 digits ptr will stor only 8 values (01000000) which comes 64.Incorrect
Hint:
To understand it you have to convert 320 to binary form which is 101000000, (9 digits) Now code is typecasting this value to char*, which takes 8 bits; so from the 9 digits ptr will stor only 8 values (01000000) which comes 64. -
Question 8 of 10
8. Question
1 pointsint main()
{
int x;
x=10,20,30;
printf(“%d”,x);
return 0;
}Correct
Hint:
When there are multiple , then assignment takes place from right to left hence 10 is the last value which is assign to x variable.Incorrect
Hint:
When there are multiple , then assignment takes place from right to left hence 10 is the last value which is assign to x variable. -
Question 9 of 10
9. Question
1 pointsHow many times Hello is printed?
int main()
{
int a = 0;
while(a++ < 5-++a)
printf(“Hello”);
return 0;
}Correct
Incorrect
-
Question 10 of 10
10. Question
1 pointsHow many times Hello is printed?
int main()
{
int a = 0;
while(a++ < 5)
printf(“Hello”);
return 0;
}Correct
Hint:
Here while loop is execuated for a = 0 to a = 4 which is 5 times execuation hence Hello is printed 5 times.Incorrect
Hint:
Here while loop is execuated for a = 0 to a = 4 which is 5 times execuation hence Hello is printed 5 times.