Here are the next set of questions for you! We will be posting 10 Technical questions everyday for your preparation. Happy learning!
rnQuestion 1: How would you round off a value from 1.66 to 2.0?
rnA. ceil (1.66)
B. floor (1.66)
C. roundup (1.66)
D. Round to (1.66)
Answer: A
rn/* Example for ceil() and floor() functions: */
rn#include<stdio.h>
rn#include<math.h>
rnint main()
rn{
rnprintf(“n Result : %f” , ceil(1.44) );
rnprintf(“n Result : %f” , ceil(1.66) );
rnprintf(“n Result : %f” , floor(1.44) );
rnprintf(“n Result : %f” , floor(1.66) );
rnreturn 0;
rn}
rn// Output:
rn// Result : 2.000000
rn// Result : 2.000000
rn// Result : 1.000000
rn// Result : 1.000000
rnQuestion 2: What will be the output of the program?
rn#include<stdio.h>
rnint X=40;
rnint main()
rn{
rnint X=20;
rnprintf(“%dn”, X);
rnreturn 0;
rn}
rnA.20
rnB.40
rnC.Error
rnD.No Output
rnAnswer: A
rnWhenever there is conflict between a local variable and global variable, the local variable gets priority.
rnQuestion 3: A long double can be used if range of a double is not enough to accommodate a real number.
rnA. True
B. False
Answer: A
True, we can use long double; if double range is not enough.
rnDouble = 8 bytes.
Long double = 10 bytes.
Question 4: A float is 4 bytes wide, whereas a double is 8 bytes wide.
rnA.True
rnB. False
rnAnswer: A
rnTrue,
float = 4 bytes.
Double = 8 bytes.
Question 5: 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.
rnA. True
B. False
Answer: A
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 as extern inside the same source file
rnQuestion 6: 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.
rnA. True
B. False
Answer: A
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 as extern inside the same source file
rnQuestion 7: Size of short integer and long integer can be verified using the size of() operator.
rnA. True
B. False
Answer: A
True, we can find the size of short integer and long integer using the sizeof() operator.
rnQuestion 8: Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform – Turbo C under DOS)
rnA. True
B. False
Answer: B
False, the range of double is -1.7e-308 to 1.7e+308.
rnQuestion 9: Size of short integer and long integer would vary from one platform to another.
rnA. True
B. False
Answer: A
True, Depending on the operating system/compiler/system architecture you are working on, the range of data types can vary.
rnQuestion 10: Range of float id -2.25e-308 to 2.25e+308
rnA. True
B. False
Answer: Option B
False, the range of float is -3.4e-38 to 3.4e+38.
rnHope you find these questions useful. Check out the questions from Set – 1 and Set – 2 in FACE Prep’s IT Article section.