Placement papers on C - Set 4
1. Is there any difference between following declarations
1 : extern int fun();
2 : int fun();
Both are identical
No difference, except extern int fun(); is probably in another file
int fun(); is overrided with extern int fun();
None of these
View Answer / Hide AnswerANSWER: No difference, except extern int fun(); is probably in another file
2. By default a real number is treated as a
float
double
long double
far double
View Answer / Hide Answer3. Is the following statement a declaration or definition?
extern int i;
Declaration
Definition
Function
Error
View Answer / Hide Answer4. Identify which of the following are declarations
extern int x;
float square ( float x ) { ... }
double pow(double, double);
None of these
View Answer / Hide AnswerANSWER: double pow(double, double);
5. When we mention the prototype of a function?
Defining
Declaring
Prototyping
Calling
View Answer / Hide Answer6. Predict the error in the following code
#include<stdio.h>
int main()
display();
return 0;
}
void display()
{
printf(""CareerRide.com"");
}
No error
display() doesn't get invoked
display() is called before it is defined
None of these
View Answer / Hide AnswerANSWER: display() is called before it is defined
7. Which of the declaration is correct?
int length
char int
int long
float double
View Answer / Hide Answer8. Which of the following operations are INCORRECT?
int i = 35; i = i%5
short int j = 255; j = j
long int k = 365L; k = k
float a = 3.14; a = a%3
View Answer / Hide AnswerANSWER: float a = 3.14; a = a%3
9. Which of the following correctly represents a long double constant?
6.68
6.68L
6.68f
6.68LF
View Answer / Hide Answer10. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten
The array size would appropriately grow.
View Answer / Hide AnswerANSWER: The program may crash if some important data gets overwritten