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

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

A
Admin
IT TestTrắc nghiệm tổng hợp69 lượt thi
50 câu hỏi
1. Trắc nghiệm
1 điểm

Which of the following functions compares two strings?

compare();

stringcompare();

cmp();

strcmp();

Xem đáp án

Chọn D

2. Trắc nghiệm
1 điểm

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

append();

stringadd();

strcat();

stradd();

Xem đáp án

Chọn C

3. Trắc nghiệm
1 điểm

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

stdio.h

conio.h

stdlib.h

ouput.h

Xem đáp án

Chọn A

4. Trắc nghiệm
1 điểm

Which function is used to read the input from console?

scanf( )

printf( )

getch( )

Xem đáp án

Chọn B

5. Trắc nghiệm
1 điểm

Which of the following are NOT relational operator?

>

>

<=

None above

Xem đáp án

Chọn D

6. Trắc nghiệm
1 điểm

In the C program, the first statement that will be executed?

The first statement of main( )

The first statement of program

The first statement after the comment /**/

The first statement of end function

Xem đáp án

Chọn A

7. Trắc nghiệm
1 điểm

Why are a function phototypes useful?

Because they tell the complier that a function is declared later

Because they make program readable

Because they allow the programmer to see a quick list of function in the program along with the argument for each function.

All of the above

Xem đáp án

Chọn A

8. Trắc nghiệm
1 điểm

Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?

rem = 3.14%2.1;

rem = fmod(3.14, 2.1);

rem = modf(3.14, 2.1);

Remainder cannot be obtain in floating point division.

Xem đáp án

Chọn B

9. Trắc nghiệm
1 điểm

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

1

2

3

1 & 2 & 3

Xem đáp án

Chọn B

10. Trắc nghiệm
1 điểm

Identify which of the following are declarationsMedia VietJack

1

2

3

1 and 3

Xem đáp án

Chọn D

11. Trắc nghiệm
1 điểm

Is the following statement a declaration or definition?Media VietJack

Declaration

Definition

A & B

Xem đáp án

Chọn A

12. Trắc nghiệm
1 điểm

Is there any difference between following declarations?Media VietJack

Both are identical

No difference, except extern int fun( ); is probably in another file

int fun( ); is overrided with extern int fun( );

None of these

Xem đáp án

Chọn A

13. Trắc nghiệm
1 điểm

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

Extern int a is declaration, int a = 20 is the definition

Int a = 20 is declaration, extern int a is the definition

Int a = 20 is definition, a is not defined

a is declared, a is not defined

Xem đáp án

Chọn A

14. Trắc nghiệm
1 điểm

What are the types of linkages?

Internal and External

External, Internal and None

External and None

Internal

Xem đáp án

Chọn B

15. Trắc nghiệm
1 điểm

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

* (asterisk)

| (pipeline)

– (hyphen)

_ (underscore)

Xem đáp án

Chọn D

16. Trắc nghiệm
1 điểm

By default a real number is treated as a

float

double

long double

far double

Xem đáp án

Chọn B

17. Trắc nghiệm
1 điểm

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

ceil(1.66)

floor(1.66)

roundup(1.66)

roundto(1.66)

Xem đáp án

Chọn A

18. Trắc nghiệm
1 điểm

Is there any difference in the following declaration?Media VietJack

Yes

No

Xem đáp án

Chọn A

19. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn B

20. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

21. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

22. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

23. Trắc nghiệm
1 điểm

Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others

Yes

No

Xem đáp án

Chọn B

24. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn B

25. Trắc nghiệm
1 điểm

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?

ABCD

DCBA

0xABCD

Depend on big endian or little endian architecture.

Xem đáp án

Chọn D

26. Trắc nghiệm
1 điểm

What are the difference types of real data type in C?

float, double

short int, double, long int

float, double, long double

double, long int, float

Xem đáp án

Chọn C

27. Trắc nghiệm
1 điểm

What will be the ouput of the program?Media VietJack

1.000000 2.000000

1.500000 1.000000

2.000000 1.000000

1.300000 2.000000

Xem đáp án

Chọn C

28. Trắc nghiệm
1 điểm

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

math.h

stdlib.h

log.h

dos.h

Xem đáp án

Chọn A

29. Trắc nghiệm
1 điểm

What will you do to treat the constant 3.14 as a long double?

use 3.14LD

use 3.14L

use 3.14DL

use 3.14LF

Xem đáp án

Chọn B

30. Trắc nghiệm
1 điểm

What will you do to treat the constant 3.14 as a float?

use float(3.14f)

use 3.14f

use f(3.14)

use (f)(3.14)

Xem đáp án

Chọn B

31. Trắc nghiệm
1 điểm

We want to round off x, a float, to an int value, The correct way to do is:

y = (int)(x + 0.5)

y = int(x + 0.5)

y = (int)x + 0.5

y = (int)((int)x + 0.5)

Xem đáp án

Chọn A

32. Trắc nghiệm
1 điểm

What will be output of the program?Media VietJack

1.670000e+000, 1.670000, 1.67, 1.670000,

Complier Error

1.67e, 1.67000, 1.670, 1.67

1.67e, 1.67, 1.67000, 1.67f

Xem đáp án

Chọn A

33. Trắc nghiệm
1 điểm

What will be output of program?Media VietJack

LaptrinhC++

abc

Complier error

None of these

Xem đáp án

Chọn B

34. Trắc nghiệm
1 điểm

What will be output of program?Media VietJack

LaptrinhC++

abc

Complier error

None of these

Xem đáp án

Chọn A

35. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

36. Trắc nghiệm
1 điểm

What is output of the program?Media VietJack

100

Garbage value

Error

0

Xem đáp án

Chọn A

37. Trắc nghiệm
1 điểm

What will happen if in the C program you assign a value to a array element whose subscript exceeds the size of array?

The element will be set to 0.

The complier would report an error.

The program may crash if some important data gets overwritten

The array size would appropriately grow

Xem đáp án

Chọn C

38. Trắc nghiệm
1 điểm

What is output of the program?Media VietJack

6.000000

6

Error

Xem đáp án

Chọn A

39. Trắc nghiệm
1 điểm

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

During editing

During linking

During execution

During preprocessing

Xem đáp án

Chọn D

40. Trắc nghiệm
1 điểm

What will be output of the program?Media VietJack

8 4 8

4 4 8

4 8 10

4 8 12

Xem đáp án

Chọn A

41. Trắc nghiệm
1 điểm

A function cannot be defined inside another function

True

False

Xem đáp án

Chọn A

42. Trắc nghiệm
1 điểm

What is the notation for following functions?Media VietJack

1. KR Notation and 2. ANSI Notation

1. Pre ANSI C Notation and 2. KR Notation

1. ANSI Notation and 2. KR Notation

1. ANSI Notation and 2. Pre ANSI Notation

Xem đáp án

Chọn C

43. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

44. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

45. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn A

46. Trắc nghiệm
1 điểm

Functions cannot return more than one value at a time

True

False

Xem đáp án

Chọn A

47. Trắc nghiệm
1 điểm

Function can be called either by value or reference

True

False

Xem đáp án

Chọn A

48. Trắc nghiệm
1 điểm

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

Infinite times

65535 times

Till stack overflows

Cannot call main( ) in main( )

Xem đáp án

Chọn C

49. Trắc nghiệm
1 điểm

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

True

False

Xem đáp án

Chọn B

50. Trắc nghiệm
1 điểm

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

Yes

No

Xem đáp án

Chọn A