C Fundamental Test 2

7) What are the various types of real data type in C language?
A.long double, short int
B.float, long double
C.short int, double, long int, float
D.float, double, long double

Correct Answer:D.(Floating data type is known as real data type.There are three types of floating data type:

float with storage size of 4 byte
long double with storage size of 10 byte
double with storage size of 8 byte.)

8) The statement used for printing \n on the screen is:
A.printf(“”);
B.printf(‘\n’);
C.printf(“\\n”);
D.printf(“n\”);

Correct Answer:C.(In C language,”\n” is the escape sequence for printing a new line character. For a statement printf(“\\n”); statement , “\\” symbol will be printed as “\” and “n” is known as a common symbol.)

9) Which of the following are declarations?
float square (float x){?}
double pow(double, double);
extern int x;
Options are given below:

A.1
B.1 and 3
C.2
D.1 and 2

Correct Answer:B.(double pow(double, double); instruction is a function prototype declaration extern int x; instruction is an external variable declaration. Therefore 1 and 3 are declarations and 2 is definition.)

10) Which header file is used to define input/output functions, macros and prototypes?
A.memory.h
B.math.h
C.dos.h
D.stdio.h

Correct Answer:D.(Header file stdio.h is used for defining the macros, variable and various functions for performing input and output operation in C-language.)

11) Single line comment in C language begins with _______
A.:
B.//
C.*/
D./*

Correct Answer:B.(For giving the comment in single line two immediate forward slashes are used. For a multi line comment it begins with /* and should be terminated with */.)

12) What is the data type of “PI” for the below statement:
#define PI 3.141
A.Float data type
B.Double datatype
C.There is no data type associated with PI
D.Syntax error, semi colon is missing with definition of PI

Correct Answer:C.(Text associated with macro statement gets expanded at line of call. The expanded text is by default a constant with no data type associated with PI.)

Warning: Undefined variable $in_same_cat in /www/wwwroot/mtexam.com/public_html/wp-content/plugins/EXP.GKFEED.COM/function.php on line 27

Warning: Undefined variable $excluded_categories in /www/wwwroot/mtexam.com/public_html/wp-content/plugins/EXP.GKFEED.COM/function.php on line 27
< PREVIOUS POSTC Fundamental Test 1

Leave A Comment?