2048.vn

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
IT TestTrắc nghiệm tổng hợp8 lượt thi
50 câu hỏi
1. Trắc nghiệm
1 điểmKhông giới hạn

Which of the following functions compares two strings?

compare();

stringcompare();

cmp();

strcmp();

Xem đáp án
2. Trắc nghiệm
1 điểmKhông giới hạn

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

append();

stringadd();

strcat();

stradd();

Xem đáp án
3. Trắc nghiệm
1 điểmKhông giới hạn

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

stdio.h

conio.h

stdlib.h

ouput.h

Xem đáp án
4. Trắc nghiệm
1 điểmKhông giới hạn

Which function is used to read the input from console?

scanf( )

printf( )

getch( )

Xem đáp án
5. Trắc nghiệm
1 điểmKhông giới hạn

Which of the following are NOT relational operator?

>

>

<=

None above

Xem đáp án
6. Trắc nghiệm
1 điểmKhông giới hạn

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
7. Trắc nghiệm
1 điểmKhông giới hạn

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
8. Trắc nghiệm
1 điểmKhông giới hạn

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
9. Trắc nghiệm
1 điểmKhông giới hạn

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

1

2

3

1 & 2 & 3

Xem đáp án
10. Trắc nghiệm
1 điểmKhông giới hạn

Identify which of the following are declarationsMedia VietJack

1

2

3

1 and 3

Xem đáp án
11. Trắc nghiệm
1 điểmKhông giới hạn

Is the following statement a declaration or definition?Media VietJack

Declaration

Definition

A & B

Xem đáp án
12. Trắc nghiệm
1 điểmKhông giới hạn

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
13. Trắc nghiệm
1 điểmKhông giới hạn

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
14. Trắc nghiệm
1 điểmKhông giới hạn

What are the types of linkages?

Internal and External

External, Internal and None

External and None

Internal

Xem đáp án
15. Trắc nghiệm
1 điểmKhông giới hạn

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

* (asterisk)

| (pipeline)

– (hyphen)

_ (underscore)

Xem đáp án
16. Trắc nghiệm
1 điểmKhông giới hạn

By default a real number is treated as a

float

double

long double

far double

Xem đáp án
17. Trắc nghiệm
1 điểmKhông giới hạn

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
18. Trắc nghiệm
1 điểmKhông giới hạn

Is there any difference in the following declaration?Media VietJack

Yes

No

Xem đáp án
19. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
20. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
21. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
22. Trắc nghiệm
1 điểmKhông giới hạ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

True

False

Xem đáp án
23. Trắc nghiệm
1 điểmKhông giới hạ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

Yes

No

Xem đáp án
24. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
25. Trắc nghiệm
1 điểmKhông giới hạ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?

ABCD

DCBA

0xABCD

Depend on big endian or little endian architecture.

Xem đáp án
26. Trắc nghiệm
1 điểmKhông giới hạn

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
27. Trắc nghiệm
1 điểmKhông giới hạn

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
28. Trắc nghiệm
1 điểmKhông giới hạn

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
29. Trắc nghiệm
1 điểmKhông giới hạn

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
30. Trắc nghiệm
1 điểmKhông giới hạn

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
31. Trắc nghiệm
1 điểmKhông giới hạn

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
32. Trắc nghiệm
1 điểmKhông giới hạn

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
33. Trắc nghiệm
1 điểmKhông giới hạn

What will be output of program?Media VietJack

LaptrinhC++

abc

Complier error

None of these

Xem đáp án
34. Trắc nghiệm
1 điểmKhông giới hạn

What will be output of program?Media VietJack

LaptrinhC++

abc

Complier error

None of these

Xem đáp án
35. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
36. Trắc nghiệm
1 điểmKhông giới hạn

What is output of the program?Media VietJack

100

Garbage value

Error

0

Xem đáp án
37. Trắc nghiệm
1 điểmKhông giới hạn

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
38. Trắc nghiệm
1 điểmKhông giới hạn

What is output of the program?Media VietJack

6.000000

6

Error

Xem đáp án
39. Trắc nghiệm
1 điểmKhông giới hạn

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
40. Trắc nghiệm
1 điểmKhông giới hạn

What will be output of the program?Media VietJack

8 4 8

4 4 8

4 8 10

4 8 12

Xem đáp án
41. Trắc nghiệm
1 điểmKhông giới hạn

A function cannot be defined inside another function

True

False

Xem đáp án
42. Trắc nghiệm
1 điểmKhông giới hạn

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
43. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
44. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
45. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
46. Trắc nghiệm
1 điểmKhông giới hạn

Functions cannot return more than one value at a time

True

False

Xem đáp án
47. Trắc nghiệm
1 điểmKhông giới hạn

Function can be called either by value or reference

True

False

Xem đáp án
48. Trắc nghiệm
1 điểmKhông giới hạn

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
49. Trắc nghiệm
1 điểmKhông giới hạn

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

True

False

Xem đáp án
50. Trắc nghiệm
1 điểmKhông giới hạn

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

Yes

No

Xem đáp án
© All rights reserved VietJack