Output Questions Set 2
Quiz-summary
0 of 9 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
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 9 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
- Answered
- Review
-
Question 1 of 9
1. Question
1 points#include
int main()
{
int a1=20,b=30,c=40;
c=10 && !a1;
printf(“c= %d\n”,c);
return 0;
}Correct
Incorrect
-
Question 2 of 9
2. Question
1 points#include <stdio.h>
int main()
{
int c;
c=(10,20,30);printf(“c= %d\n”,c);
return 0;
}Correct
Incorrect
-
Question 3 of 9
3. Question
1 points#include <stdio.h>
int main()
{
int a;
a=printf(“hello %dhi”,printf(“World”));
printf(“%d”,a);
return 0;
}Correct
Incorrect
-
Question 4 of 9
4. Question
1 points#include <stdio.h>
int main()
{
char s[ ]=”God”;
int i;
for(i=0;s[i];i++)
printf(“%c%c%c%c”,s[i],*(s+i),*(i+s),i[s]);
getch();
return 0;
}Correct
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways
of expressing the same idea. Generally array name is the
base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising.
But in the case of C it is same as s[i].Incorrect
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways
of expressing the same idea. Generally array name is the
base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising.
But in the case of C it is same as s[i]. -
Question 5 of 9
5. Question
1 points#include <stdio.h>
int main()
{
float me = 1.1;
double you = 1.1;if(me==you)
printf(“Yes”);
else
printf(“No”);
return 0;
}Correct
Explanation:
For floating point numbers (float, double, long double)
the values cannot be predicted exactly.
Depending on the number of bytes,
the precession of the value represented varies.
Float takes 4 bytes and long double takes 10 bytes.
So float stores 0.9 with less precision than long double.
Note:
Never compare or at-least be cautious when using
floating point numbers with relational operators (== , >, <, <=, >=,!= ) .Incorrect
Explanation:
For floating point numbers (float, double, long double)
the values cannot be predicted exactly.
Depending on the number of bytes,
the precession of the value represented varies.
Float takes 4 bytes and long double takes 10 bytes.
So float stores 0.9 with less precision than long double.
Note:
Never compare or at-least be cautious when using
floating point numbers with relational operators (== , >, <, <=, >=,!= ) . -
Question 6 of 9
6. Question
1 points#include <stdio.h>
int main()
{
float me = 1.1;
double you = 1.1;if(me==1.1)
printf(“Yes”);
else
printf(“No”);
return 0;
}Correct
Incorrect
-
Question 7 of 9
7. Question
1 points#include <stdio.h>
int main()
{
static int var = 5;
printf(“%d “,var–);
if(var)
main();
return 0;
}Correct
Explanation:
When static storage class is given,
it is initialized once.
The change in the value of a static variable is retained
even between the function calls.
Main is also treated like any other ordinary function,
which can be called recursively.Incorrect
Explanation:
When static storage class is given,
it is initialized once.
The change in the value of a static variable is retained
even between the function calls.
Main is also treated like any other ordinary function,
which can be called recursively. -
Question 8 of 9
8. Question
1 points#include <stdio.h>
int main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*q=c;for(j=0;j<5;j++)
{
printf(” %d “,*c);
++q;
}return 0;
}Correct
Explanation:
Initially pointer c is assigned to q.
In the loop, since only q is incremented and not c ,
the value 2 will be printed 5 times.Incorrect
Explanation:
Initially pointer c is assigned to q.
In the loop, since only q is incremented and not c ,
the value 2 will be printed 5 times. -
Question 9 of 9
9. Question
1 points#include <stdio.h>
int i;
int main()
{
printf(“%d”,i);
i=20;
printf(“%d”,i);return 0;
}Correct
i when declared above main become a global variable. default value of
global variable is 0.
and inside main it is initilised as 20.
so output is 020Incorrect
i when declared above main become a global variable. default value of
global variable is 0.
and inside main it is initilised as 20.
so output is 020