C Programming - Declarations and Initializations
Exercise : Declarations and Initializations - Point Out Correct Statements
- Declarations and Initializations - General Questions
- Declarations and Initializations - Find Output of Program
- Declarations and Initializations - Point Out Errors
- Declarations and Initializations - Point Out Correct Statements
- Declarations and Initializations - True / False Questions
- Declarations and Initializations - Yes / No Questions
1.
Which of the declaration is correct?
Answer: Option
Explanation:
int length; denotes that variable length is int(integer) data type.
char int; here int is a keyword cannot be used a variable name.
int long; here long is a keyword cannot be used a variable name.
float double; here double is a keyword cannot be used a variable name.
So, the answer is int length;(Option A).
2.
Which of the following operations are INCORRECT?
Answer: Option
Explanation:
float a = 3.14; a = a%3; gives "Illegal use of floating point" error.
The modulus (%) operator can only be used on integer types. We have to use fmod() function in math.h for float values.
3.
Which of the following correctly represents a long double constant?
Answer: Option
Explanation:
6.68 is double.
6.68L is long double constant.
6.68f is float constant.
6.68LF is not allowed in c.
4.
Which of the structure is incorrcet?
1 : |
|
2 : |
|
3 : |
|
Answer: Option
Explanation:
Option B gives "Undefined structure in 'aa'" error.
5.
Which of the structure is correct?
1 : |
|
2 : |
|
3 : |
|
Answer: Option
Explanation:
In 2 and 3 semicolon are missing in structure element.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers