vietjack.com

400 Câu hỏi trắc nghiệm lập trình C/C++ có đáp án (Phần 2)
Quiz

400 Câu hỏi trắc nghiệm lập trình C/C++ có đáp án (Phần 2)

A
Admin
50 câu hỏiIT TestTrắc nghiệm tổng hợp
50 CÂU HỎI
1. Nhiều lựa chọn

Which of the following functions compares two strings?

A. compare();

B. stringcompare();

C. cmp();

D. strcmp();

2. Nhiều lựa chọn

Which of the following adds one string to the end of another?

A. append();

B. stringadd();

C. strcat();

D. stradd();

3. Nhiều lựa chọn

In which standard library file is the function printf( ) located?

A. stdio.h

B. conio.h

C. stdlib.h

D. ouput.h

4. Nhiều lựa chọn

Which function is used to read the input from console?

A. scanf( )

B. printf( )

C. getch( )

5. Nhiều lựa chọn

Which of the following are NOT relational operator?

A. >

B. >

C. <=

D. None above

6. Nhiều lựa chọn

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

7. Nhiều lựa chọn

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

8. Nhiều lựa chọn

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.

9. Nhiều lựa chọn

Which of the following is not user define data type? Media VietJack

A. 1

B. 2

C. 3

D. 1 & 2 & 3

10. Nhiều lựa chọn

Identify which of the following are declarations Media VietJack

A. 1

B. 2

C. 3

D. 1 and 3

11. Nhiều lựa chọn

Is the following statement a declaration or definition? Media VietJack

A. Declaration

B. Definition

C. A & B

12. Nhiều lựa chọn

Is there any difference between following declarations? Media VietJack

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

13. Nhiều lựa chọn

In the following program where is the variable a getting defined and where it is getting declared? Media VietJack

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

14. Nhiều lựa chọn

What are the types of linkages?

A. Internal and External

B. External, Internal and None

C. External and None

D. Internal

15. Nhiều lựa chọn

Which of the following special symbol allowed in a variable name?

A. * (asterisk)

B. | (pipeline)

C. – (hyphen)

D. _ (underscore)

16. Nhiều lựa chọn

By default a real number is treated as a

A. float

B. double

C. long double

D. far double

17. Nhiều lựa chọn

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)

18. Nhiều lựa chọn

Is there any difference in the following declaration? Media VietJack

A. Yes

B. No

19. Nhiều lựa chọn

A long double can be used if range of a double is not enough to accommodate a real number?

A. True

B. False

20. Nhiều lựa chọn

A float is 4 byte wide, whereas a double is 8 byte wide

A. True

B. False

21. Nhiều lựa chọn

Size of short integer and long integer can be verified using the sizeof( ) operator

A. True

B. False

22. Nhiều lựa chọn

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

23. Nhiều lựa chọn

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

24. Nhiều lựa chọn

Size of short integer and long integer would vary from one platform to another

A. True

B. False

25. Nhiều lựa chọn

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.

26. Nhiều lựa chọn

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

27. Nhiều lựa chọn

What will be the ouput of the program? Media VietJack

A. 1.000000 2.000000

B. 1.500000 1.000000

C. 2.000000 1.000000

D. 1.300000 2.000000

28. Nhiều lựa chọn

Which library will you add in the following program to work it correctly? Media VietJack

A. math.h

B. stdlib.h

C. log.h

D. dos.h

29. Nhiều lựa chọn

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

30. Nhiều lựa chọn

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)

31. Nhiều lựa chọn

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)

32. Nhiều lựa chọn

What will be output of the program? Media VietJack

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

33. Nhiều lựa chọn

What will be output of program? Media VietJack

A. LaptrinhC++

B. abc

C. Complier error

D. None of these

34. Nhiều lựa chọn

What will be output of program? Media VietJack

A. LaptrinhC++

B. abc

C. Complier error

D. None of these

35. Nhiều lựa chọn

If the file tobe included does not exist, the preprocessor flashes an error message

A. True

B. False

36. Nhiều lựa chọn

What is output of the program? Media VietJack

A. 100

B. Garbage value

C. Error

D. 0

37. Nhiều lựa chọn

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

38. Nhiều lựa chọn

What is output of the program? Media VietJack

A. 6.000000

B. 6

C. Error

39. Nhiều lựa chọn

In which stage the following code. Gets replaced by the contents of the file stdio.h Media VietJack

A. During editing

B. During linking

C. During execution

D. During preprocessing

40. Nhiều lựa chọn

What will be output of the program? Media VietJack

A. 8 4 8

B. 4 4 8

C. 4 8 10

D. 4 8 12

41. Nhiều lựa chọn

A function cannot be defined inside another function

A. True

B. False

42. Nhiều lựa chọn

What is the notation for following functions? Media VietJack

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

43. Nhiều lựa chọn

Name of functions in two different files linked together must be unique.

A. True

B. False

44. Nhiều lựa chọn

If return type for a function is not specified, it defaults to int

A. True

B. False

45. Nhiều lựa chọn

A function may have ant number of return statements each returning different values.

A. True

B. False

46. Nhiều lựa chọn

Functions cannot return more than one value at a time

A. True

B. False

47. Nhiều lựa chọn

Function can be called either by value or reference

A. True

B. False

48. Nhiều lựa chọn

How many times the program will print “laptrinhc++”? Media VietJack

A. Infinite times

B. 65535 times

C. Till stack overflows

D. Cannot call main( ) in main( )

49. Nhiều lựa chọn

In C all function except main( ) can be called recursively

A. True

B. False

50. Nhiều lựa chọn

Is it true that too many recursive calls may result into stack overflow?

A. Yes

B. No

© All rights reserved VietJack