1. Trang chủ
  2. » Tất cả

100 c interview questions answers

12 415 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề 100 C Interview Questions Answers
Trường học University of Technology
Chuyên ngành Computer Science
Thể loại Essay
Năm xuất bản 2023
Thành phố Hanoi
Định dạng
Số trang 12
Dung lượng 82,71 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

ans: e reason: %p represents the pointer format specifier.. ans: c reason: printf returns the total no... ans: d reason: The puts prints and places the cursor in the next line, wh

Trang 1

1

ans: (a)

reason:

you cannot declare structure as unsized array

2

ans: (b)

reason:

The return st returns x value first as it is and then

decrements its value

Its post decrement

3

ans: (e)

reason:

%p represents the pointer format specifier It prints the

value in

hexa decimal upto four digits

4

ans: (b)

5

ans: (b)

reason:

The values in the if st () is said to be in the stack So the last element

in the stack is taken as check value(zero/non-zero) Here TRUE

is -1 i.e

success stateand x+y is printed

6

/* Unsolved*/

7

ans: (c)

reason:

Static initializes all to 0

8

Trang 2

ans: (b)

reason:

char pointer size = 1

int pointer size = 2

9

ans: (d)

reason:

10

ans: (c)

reason:

printf returns the total no of characters it prints on the screen

11

ans: (c)

unsolved*/

12

reason:

;;; doesnot matter This indicates only an empty statement The o/p will be 3,1

13

ans: (b)

14

ans: (d)

reason:

The puts prints and places the cursor in the next line,

whereas

the printf prints and places the cursor in the same line

15

ans: (c)

reason:

You need to put '=' sign at show ie the correct st is end=(char*)(show=(char*)strcpy(start,"MISPIS,"));

or else expression error

Trang 3

16

ans: (e)

reason:

The _fastcall keyword is reserved for

programming under Windows and OS/2

17

ans: (a)

reason:

The strcmp returns 0 if zone==target, If 0 the ?: assigns fail st i.e 0

This is false value for IF st and hence else part is

executed

18

ans: (c)

reason:

t1 is an array So you need to specify the subscript value while

you assign any element to it

char *t1; t1="craft" is correct since *t1 is a pointer and it points

to the starting addr of the craft

19

ans: (b)

unsolved

20

ans: (b)

21

ans: (a)

reason:

Its a static array

22

ans: (b)

Trang 4

unsolved

23

ans : (a)

24

ans: (d)

25

ans: (c)

reason:

c+ +100 is not valid as c=c+100

26

ans: (d)

27

ans: (a)

28

ans: (b)

29

ans: (a)

30

ans:(c)

31

ans: (d)

32

ans: (e)

reason: incompatiable type conversions

33

ans: (c)

reason: odd no AND with 1 gives TRUE value always

Trang 5

34

ans:

(b)

reason:

if we mention the string as two dimentional(for more than one dim)

array with in printf statement,then we should give

'&'symbol

35

ans: (b)

reason:

res=0+1/5;

res=1/5+1/4;

res=1/5+1/4+1/3;

res=1/5+1/4+1/3+1/2+1/1;

At last time

res=1/5+1/4+1/3+1/2+1/1+1/0;

^ | zero divide occur

36

ans: (b)

reason:

'%c' mainly used for print one charactor

We can't specify formate output within '%c'

37

ans: (b)

reason:

can not modify constant value

It is a fixed value for entire program

38

ans: (b)

reason:

'argc' holds number of arguments

argc consist always value 1 becase file name is one of the input

therefore 1<1 gives false whereas 1==1 gives true

Trang 6

39

ans: (a)

reason:

% followed by non-format specifier is printed as such with % symbol

40

ans : (b)

reason: if no format specifier is given immediately after the first appearance of % then the characters after the % are

printed as such

41

ans: (d)

reason:

the scanf must have &x,&y for %d format specifiers

42

ans: (a)

reason:

In if statement, x=6 is assigned and not checked

43

ans: (d)

reason: self

44

ans: (a)

reason: odometer principle, since a is unsigned it is always +ve

45

ans: (a)

reason: self

46

ans: (e)

Trang 7

reason: unsolved

47

ans: (c)

reason: x will contain the garbage value hence default

48

ans: (b)

reason: x will contain the garbage value hence default

49

ans: (b)

reason: self

50

ans: (b)

reason: self

51

ans: (b)

reason: recursive function

52

ans: (d)

reason: t is a pointer and memory allocation is not needed for that

53

ans: (a)

reason: Each 0 bit in the operand is set to 1, and each 1 bit

in the operand is set to 0 if we use ~

54

ans: (c)

Trang 8

reason: int x:8 will get only first 8 bits assigned to it ie.,

1 byte of size

int x:9 will get only first 9 bits assigned to it ie., 2 byte

of size

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

x : 8 a a a a a a a a n n n n n n n n

x : 9 a a a a a a a a a n n n n n n n

- -

1 byte 1 byte

55

ans: (e)

reason:

56

ans: (b)

reason: self

57

ans: (d)

reason: self

58

ans: (a)

reason: can't understand

59

ans: (b)

reason: self

60

ans: (c)

reason:

61

Trang 9

ans: (1)

reason: self

62

ans: (b)

63

ans: (c)

64

ans: (a)

65

ans:(c)

66

ans: (f)

67

ans: (b)

reason : if you give int main() it goes to infinite loop

68

ans: (d)

69

ans: (b)

70

ans: (b)

71

ans: (c)

72

ans: (e)

73

ans: (b)

Trang 10

reason: if name is given the output is hai

74

ans: (a)

75

ans: (b)

76

ans: (a)

77

ans: (c)

78

ans: (c)

79

ans: (a)

80

ans: (a)

81

82

ans: (d)

reason : pointers cannot be added

83

ans: (d)

84

ans: (b)

reason: stack concept

Trang 11

85

ans: (b)

86

ans: (a)

87

ans: (c)

88

ans: (c)

89

ans: (a)

90

ans: (a)

91

92

93

ans:(c)

94

ans: (d)

reason: message[] is correct

95

ans: (c)

reason: static is not allowed in main( ) If removed, junk value

96

ans: (a)

reason: self

Trang 12

97

ans: (b)

reason:

98

ans: (a)

99

ans: (b)

reason:

100

ans: (c)

reason: *_ is an allowed variable

Ngày đăng: 07/02/2013, 09:37

TỪ KHÓA LIÊN QUAN

w