Ten Technical Interview/Aptitude Questions for you – Set 3

Ten Technical Interview/Aptitude Questions for you – Set 3

Here are the next set of questions for you! We will be posting 10 Technical questions everyday for your preparation. Happy learning!

rn

Question 1:  How would you round off a value from 1.66 to 2.0?

rn

A. ceil (1.66)
B. floor (1.66)
C. roundup (1.66)
D. Round to (1.66)

rn

Answer: A

rn

/* Example for ceil() and floor() functions: */

rn

#include<stdio.h>

rn

#include<math.h>

rn

int main()

rn

{

rn

    printf(“n Result : %f” , ceil(1.44) );

rn

    printf(“n Result : %f” , ceil(1.66) );

rn

    printf(“n Result : %f” , floor(1.44) );   

rn

    printf(“n Result : %f” , floor(1.66) );

rn

    return 0;

rn

}

rn

// Output:

rn

// Result : 2.000000

rn

// Result : 2.000000

rn

// Result : 1.000000

rn

// Result : 1.000000

rn

Question 2: What will be the output of the program?

rn

#include<stdio.h>

rn

int X=40;

rn

int main()

rn

{

rn

    int X=20;

rn

    printf(“%dn”, X);

rn

    return 0;

rn

}

rn

A.20

rn

B.40

rn

C.Error

rn

D.No Output

rn

Answer:  A

rn

Whenever there is conflict between a local variable and global variable, the local variable gets priority.

rn

Question 3:  A long double can be used if range of a double is not enough to accommodate a real number.

rn

A. True
B. False

rn


Answer: A

rn

True, we can use long double; if double range is not enough.

rn

Double = 8 bytes.
Long double = 10 bytes.

rn

Question 4: A float is 4 bytes wide, whereas a double is 8 bytes wide.

rn

A.True

rn

B. False

rn

Answer: A

rn

True,
float = 4 bytes.
Double = 8 bytes.

rn

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.

rn

A. True
B. False
Answer: A

rn

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

rn

Question 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.

rn

A. True
B. False
Answer: A

rn

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

rn

Question 7: Size of short integer and long integer can be verified using the size of() operator.

rn

A. True
B. False
Answer: A

rn

True, we can find the size of short integer and long integer using the sizeof() operator.

rn

Question 8: Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform – Turbo C under DOS)

rn

A. True
B. False
Answer: B

rn

False, the range of double is -1.7e-308 to 1.7e+308.

rn

Question 9: Size of short integer and long integer would vary from one platform to another.

rn

A. True
B. False
Answer: A

rn

True, Depending on the operating system/compiler/system architecture you are working on, the range of data types can vary.

rn

Question 10: Range of float id -2.25e-308 to 2.25e+308

rn

A. True
B. False
Answer: Option B

rn

False, the range of float is -3.4e-38 to 3.4e+38.

rn

Hope you find these questions useful. Check out the questions from Set – 1 and Set – 2 in FACE Prep’s IT Article section.

c