Fundamentals of



Download 9.46 Mb.
Page18/57
Date09.01.2017
Size9.46 Mb.
#8172
1   ...   14   15   16   17   18   19   20   21   ...   57

Ans

Que No

Ans

Que No

Ans

1

D

16

B

31

A

46

A

61

A

2

C

17

B

32

A

47

B

62

C

3

A

18

C

33

A

48

B

63

C

4

C

19

C

34

D

49

B

64

D

5

C

20

A

35

D

50

A

65

C

6

B

21

A

36

B

51

A

66

A

7

D

22

A

37

A

52

B

67

D

8

A

23

B

38

A

53

C

68

A

9

C

24

A

39

B

54

A

69

D

10

B

25

A

40

B

55

B

70

B

11

C

26

D

41

A

56

A

71

B

12

C

27

A

42

A

57

C

72

B

13

C

28

B

43

B

58

A

73

D

14

B

29

A

44

B

59

B







15

D

30

D

45

B

60

A












Function String Array etc.

Q.1 Find the output of the following program

#include<stdio.h>

int X=40;

void main()

{

int X=20;



printf(%d\n X)

}

(a)20 (b)40 (c)60 (d)Error


Q.2 Find the output of the following program

#include



void main()

{

int fun(float); int a; a=fun(3.14); printf(“%d\n” a)



}

int fun(int aa)

{

return(int)++aa;

}



(a)3 (b)4 (c)0

(d)Error




Q.3 Find the output of the following program

#include



void main()

{

int a[5]={2,3};



printf(“%d%d%d\n” a*2+ a*2+ a*4+)

}

(a)Garbage Values (b)2,3,3 (c)3,2,2 (d)0,0,0


Q.4 Find the output of the following program

#include<stdio.h>

void main()

{

diplay();

}

void display()

{

printf(“=ndiaB=X”)



}

(a)No Error (b)display doesnt get invoked (c)display() is called before it is defined


(d)None of the above


Q.5 A function cannot be overloaded only by its return type

(a)True (b)False


Q.6 A function can be overloaded with a return type if it has all the parameters same.

(a)True (b)False


Q.7 Inline functions involves some additional overhead in running time.

(a)True (b)False


Q.8 A Function that calls itself is known as


(a)Inline Function

(c)Overloaded Function

(b)Nested Function

(d)recursive Function





Q.9 The return type of a function that does not have any return type is declared as

(a)long (b)double (c)void (d)int


Q.10 Parameters passed to a function are separated with


(a)comma(,) (c)colon(;)

(b)semicolon(;) (d)None of above





Q.11 Variables declared inside the parenthesis of a function have visibility.

(a)Local (b)Global (c)Module (d)Universal


Q.12 According the following declaration of a function, which of the statement given below is true

true int function(int a,int b=2)



(a)Variable b is of integer type and will always have value 2

(b)Variable a and b are of int type and the initial value of both variables is 2 (c)Variable b is global scope and will have value 2



(d)Variable b will have value 2 if not specified when calling function
Q.13 String is an array of character arrays terminated with_

(a)\n (b)\t (c)\0 (d)\1


Q.14 The void specifier is used if a function does not have return type.

(a)True (b)false


Q.15 According to the following statements, select the best suitable statement

int x=5,y=3,z;

a=add(x,y)

(a)The function add is called by passing the values (b) The function add is called by passing reference (c) Both (a and b) of above



(d)None of above
Q.16 According to the following code, select the best suitable statement

int x=5,y=3,z;



a=add(&x,&y)


(a)The function add is called by passing the values (b) The function add is called by passing reference (c) Both (a and b) of above



(d)None of above
Q.17 In case of arguments passed by values when calling a function such as z=add(x,y)

(a) ny modifications to the variables x and y from inside the function “add” will not have any effect



on the variables outside the function.

(b)The variables x y will be updated when any modification is done in the function add

(c)Yhe variable x y will be modified as per modification in the function add but the Variable y will not be

updated as per the variation in the function add

(d)None of the above
Q.18 If the type specifier of parameters of a function call is followed by an ampersand (&) and then the variable names, that function call is


(a)pass by value

(c)pass by variables

(b)pass by reference

(d)none of above

1   ...   14   15   16   17   18   19   20   21   ...   57




The database is protected by copyright ©ininet.org 2024
send message

    Main page