50 CÂU HỎI
Which of the following functions compares two strings?
A. compare();
B. stringcompare();
C. cmp();
D. strcmp();
Which of the following adds one string to the end of another?
A. append();
B. stringadd();
C. strcat();
D. stradd();
In which standard library file is the function printf( ) located?
A. stdio.h
B. conio.h
C. stdlib.h
D. ouput.h
Which function is used to read the input from console?
A. scanf( )
B. printf( )
C. getch( )
Which of the following are NOT relational operator?
A. >
B. >
C. <=
D. None above
In the C program, the first statement that will be executed?
A. The first statement of main( )
B. The first statement of program
C. The first statement after the comment /**/
D. The first statement of end function
Why are a function phototypes useful?
A. Because they tell the complier that a function is declared later
B. Because they make program readable
C. Because they allow the programmer to see a quick list of function in the program along with the argument for each function.
D. All of the above
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?
A. rem = 3.14%2.1;
B. rem = fmod(3.14, 2.1);
C. rem = modf(3.14, 2.1);
D. Remainder cannot be obtain in floating point division.
Which of the following is not user define data type?
A. 1
B. 2
C. 3
D. 1 & 2 & 3
Identify which of the following are declarations
A. 1
B. 2
C. 3
D. 1 and 3
Is the following statement a declaration or definition?
A. Declaration
B. Definition
C. A & B
Is there any difference between following declarations?
A. Both are identical
B. No difference, except extern int fun( ); is probably in another file
C. int fun( ); is overrided with extern int fun( );
D. None of these
In the following program where is the variable a getting defined and where it is getting declared?
A. Extern int a is declaration, int a = 20 is the definition
B. Int a = 20 is declaration, extern int a is the definition
C. Int a = 20 is definition, a is not defined
D. a is declared, a is not defined
What are the types of linkages?
A. Internal and External
B. External, Internal and None
C. External and None
D. Internal
Which of the following special symbol allowed in a variable name?
A. * (asterisk)
B. | (pipeline)
C. – (hyphen)
D. _ (underscore)
By default a real number is treated as a
A. float
B. double
C. long double
D. far double
How would you round off a value from 1.66 to 2.0?
A. ceil(1.66)
B. floor(1.66)
C. roundup(1.66)
D. roundto(1.66)
Is there any difference in the following declaration?
A. Yes
B. No
A long double can be used if range of a double is not enough to accommodate a real number?
A. True
B. False
A float is 4 byte wide, whereas a double is 8 byte wide
A. True
B. False
Size of short integer and long integer can be verified using the sizeof( ) operator
A. True
B. False
If the definition of 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
A. True
B. False
Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others
A. Yes
B. No
Size of short integer and long integer would vary from one platform to another
A. True
B. False
A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?
A. ABCD
B. DCBA
C. 0xABCD
D. Depend on big endian or little endian architecture.
What are the difference types of real data type in C?
A. float, double
B. short int, double, long int
C. float, double, long double
D. double, long int, float
What will be the ouput of the program?
A. 1.000000 2.000000
B. 1.500000 1.000000
C. 2.000000 1.000000
D. 1.300000 2.000000
Which library will you add in the following program to work it correctly?
A. math.h
B. stdlib.h
C. log.h
D. dos.h
What will you do to treat the constant 3.14 as a long double?
A. use 3.14LD
B. use 3.14L
C. use 3.14DL
D. use 3.14LF
What will you do to treat the constant 3.14 as a float?
A. use float(3.14f)
B. use 3.14f
C. use f(3.14)
D. use (f)(3.14)
We want to round off x, a float, to an int value, The correct way to do is:
A. y = (int)(x + 0.5)
B. y = int(x + 0.5)
C. y = (int)x + 0.5
D. y = (int)((int)x + 0.5)
What will be output of the program?
A. 1.670000e+000, 1.670000, 1.67, 1.670000,
B. Complier Error
C. 1.67e, 1.67000, 1.670, 1.67
D. 1.67e, 1.67, 1.67000, 1.67f
What will be output of program?
A. LaptrinhC++
B. abc
C. Complier error
D. None of these
What will be output of program?
A. LaptrinhC++
B. abc
C. Complier error
D. None of these
If the file tobe included does not exist, the preprocessor flashes an error message
A. True
B. False
What is output of the program?
A. 100
B. Garbage value
C. Error
D. 0
What will happen if in the C program you assign a value to a array element whose subscript exceeds the size of array?
A. The element will be set to 0.
B. The complier would report an error.
C. The program may crash if some important data gets overwritten
D. The array size would appropriately grow
What is output of the program?
A. 6.000000
B. 6
C. Error
In which stage the following code. Gets replaced by the contents of the file stdio.h
A. During editing
B. During linking
C. During execution
D. During preprocessing
What will be output of the program?
A. 8 4 8
B. 4 4 8
C. 4 8 10
D. 4 8 12
A function cannot be defined inside another function
A. True
B. False
What is the notation for following functions?
A. 1. KR Notation and 2. ANSI Notation
B. 1. Pre ANSI C Notation and 2. KR Notation
C. 1. ANSI Notation and 2. KR Notation
D. 1. ANSI Notation and 2. Pre ANSI Notation
Name of functions in two different files linked together must be unique.
A. True
B. False
If return type for a function is not specified, it defaults to int
A. True
B. False
A function may have ant number of return statements each returning different values.
A. True
B. False
Functions cannot return more than one value at a time
A. True
B. False
Function can be called either by value or reference
A. True
B. False
How many times the program will print “laptrinhc++”?
A. Infinite times
B. 65535 times
C. Till stack overflows
D. Cannot call main( ) in main( )
In C all function except main( ) can be called recursively
A. True
B. False
Is it true that too many recursive calls may result into stack overflow?
A. Yes
B. No