1. |
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ans-c fmod(x,y) - Calculates x modulo y, the remainder of x/y. This function is the same as the modulus operator. But fmod() performs floating point divisions. 2--
External Linkage-> means global, non-static variables and functions.
Internal Linkage-> means static variables and functions with file scope. None Linkage-> means Local variables.
3--
|
Q--7
When we mention the prototype of a function?
| ||||||||
Explanation:
A function prototype in C or C++ is a declaration of a function that omits the function body but does specify the function's name, argument types and return type.
While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.
|
-------------------------------------------------------------------PREDCT OUTPUT ---------------------
1-What is the output of the program given below ?
| ||||||||
Answer: Option C
Explanation:
enum takes the format like {0,1,2..) so pass=0, fail=1, atkt=2
stud1 = pass (value is 0)
stud2 = atkt (value is 2)
stud3 = fail (value is 1)
Hence it prints 0, 2, 1
|
What will be the output of the program in 16 bit platform (Turbo C under DOS)?
| ||||||||||||||||||
Answer: Option D
Explanation:
Linker Error : Undefined symbol 'i'
The statement extern int i specifies to the compiler that the memory for 'i' is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name 'i' is available in any other program with memory space allocated for it. Hence a linker error has occurred.
Q3
|
What is the output of the program
| ||||||||
Answer: Option A
Explanation:
When an automatic structure is partially initialized remaining elements are initialized to 0(zero).
|
Q6
What is the output of the program
| ||||||||
Answer: Option B
Explanation:
Since x < y turns to be TRUE it is replaced by 1. Then 1 < z is compared and to beTRUE. The 1 is assigned to i.
|
Q7
What is the output of the program
| ||||||||||
Answer: Option E
Explanation:
2 Errors
1. Type mismatch in redeclaration of fun 2. Type mismatch in parameter aa |
q8--
| ||||||||
Answer: Option D
Explanation:
When an automatic array is partially initialized, the remaining elements are initialized to 0.
|
Q10
In the following program how long will the for loop get executed?
| ||||||||
Answer: Option D
Explanation:
During the for loop execution scanf() ask input and then printf() prints that given input. This process will be continued repeatedly because, scanf() returns the number of input given, the condition is always true(user gives a input means it reurns '1').
Hence this for loop would get executed infinite times.
|
Q11
Which of the following operations are INCORRECT?
| ||||||||
Answer: Option D
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.
|
Q12
Which of the following correctly represents a long double constant?
| ||||||||
Answer: Option B
Explanation:
6.68 is double.
6.68L is long double constant. 6.68f is float constant. 6.68LF is not allowed in c. |
Q13
6. |
| |||||||
Answer: Option C
Explanation:
typedef long a;
extern int a c; while compiling this statement becomes extern int long c;. This will result in to "Declaration syntax error".
typedef long a;
extern a int c; while compiling this statement becomes extern long int c;. This will result in to "Too many types in declaration error".
typedef long a;
extern a c; while compiling this statement becomes extern long c;. This is a valid c declaration statement. It says variable c is long data type and defined in some other file or module.
So, Option C is the correct answer.
|
Q
If the definition of the external variable occurs in the source file before its use in a particular function, then there is no need for an extern declaration in the function.
| ||||
Answer: Option A
Explanation:
True, When a function is declared inside the source file, that function(local function) get a priority than the extern function. So there is no need to declare a function asextern inside the same source file.
|
Q
Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others.
| ||||
Answer: Option B
Explanation:
The only way this can be achieved is to define the variable locally in main() instead of defining it globally and then passing it to the functions which need it.
|
Q
Is it true that a global variable may have several declarations, but only one definition?
| ||||
Answer: Option A
Explanation:
Yes, In all the global variable declarations, you need to use the keyword extern.
|
No comments:
Post a Comment