set 4
Variable And Data Types 4
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Variables And Data Types
Questions based on:
* Data Types in C language
* Format Specifiers
* Tokens
* Identifiers
* Constants
* Keywords
* Operators
* sizeof()
* enum
* typedef
* typecasting, etc.
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 pointssizeof(unsigned long) will be _____ ?
Correct
Incorrect
-
Question 2 of 10
2. Question
1 pointsWhich is correct with respect to size of the datatypes?
Correct
char has lesser bytes than int and int has lesser bytes than double in any system.
Incorrect
char has lesser bytes than int and int has lesser bytes than double in any system.
-
Question 3 of 10
3. Question
1 pointsWhat will be the output of the C program?
#include<stdio.h>
int main()
{
void num=10;
printf(“%v”, num);
return 0;
}
Correct
Void is not a valid data type for declaring variables.
Incorrect
Void is not a valid data type for declaring variables.
-
Question 4 of 10
4. Question
1 pointsWhat will be the output of the C program?
#include<stdio.h>
int main()
{
printf(“%d\t”,sizeof(2.5));
printf(“%d”,sizeof(‘A’));
return 0;
}
Correct
C compiler by default will assign any undeclared float data type as double. Thus 8 1 is outputted
Incorrect
C compiler by default will assign any undeclared float data type as double. Thus 8 1 is outputted
-
Question 5 of 10
5. Question
1 pointsWhich of the following data type is right in C programming?
Correct
Incorrect
-
Question 6 of 10
6. Question
1 pointsWhat is the size of an int data type?
Correct
The size of the data types depend on the system/compiler.
Incorrect
The size of the data types depend on the system/compiler.
-
Question 7 of 10
7. Question
1 pointsWhat will be the output of the following C code?
#include <stdio.h>
int main()
{
enum {ORANGE = 5, MANGO, BANANA = 4,APPLE};
printf(“APPLE = %d\n”, APPLE);
}
Correct
In enum, the value are assigned by default starting from zero(0) and gets incremented by 1. i.e. 1st is assigned value 0, 2nd as 1 and so on. If any enumerator is assigned a value it takes the assigned value and the next enumerator has value one more than the previous one.
Incorrect
In enum, the value are assigned by default starting from zero(0) and gets incremented by 1. i.e. 1st is assigned value 0, 2nd as 1 and so on. If any enumerator is assigned a value it takes the assigned value and the next enumerator has value one more than the previous one.
-
Question 8 of 10
8. Question
1 pointsWhat is short int in C programming?
Correct
Incorrect
-
Question 9 of 10
9. Question
1 pointsWhat will be the output of the following C code?
#include <stdio.h>
int main()
{
float x = ‘a’;
printf(“%f”, x);
return 0;
}
Correct
Explanation: Since the ASCII value of a is 97, the same is assigned to the float variable and printed.
Output:
97.000000Incorrect
Explanation: Since the ASCII value of a is 97, the same is assigned to the float variable and printed.
Output:
97.000000 -
Question 10 of 10
10. Question
1 pointsWhat will be the output of the following C code?
#include <stdio.h>
int main()
{
const int p;
p = 4;
printf(“p is %d”, p);
return 0;
}
Correct
Explanation: Since the constant variable has to be declared and defined at the same time, not doing it results in an error.
After declaration if we change the value it will generate an error, as const cannot be changed.Incorrect
Explanation: Since the constant variable has to be declared and defined at the same time, not doing it results in an error.
After declaration if we change the value it will generate an error, as const cannot be changed.