Slideshow

Monday, 25 February 2013


Q.41 Which is not dynamic memory allocation function?
(A) malloc (B) free
(C) alloc (D) calloc
Ans: C
Three dynamic memory allocation functions are: malloc, calloc and free
Q.42 Which header file is used for screen handling function:-
(A) IO.H (B) STDLIB.H
(C) CONIO.H (D) STDIO.H
Ans: D
The header file stdio.h contains definitions of constants,macros and types, along with
function declarations for standard I/O functions.
Q.43 Choose the directive that is used to remove previously defined definition of the macro
name that follows it -
(A) # remdef (B) # pragma
(C) # undef (D) # define
Ans: C
The preprocessor directive #undef OKAY would cause the definition of OKAY to be
removed from the system.
Q.44 The output of the following is
x = ‘a’;
printf(“%d”, x);
(A) ‘a’ (B) a
(C) 97 (D) None of the above
Ans: C
The printf statement is printing ascii value of a, that is 97.
Q.45 Consider the following statement
int j, k, p;
float q, r, a;
a = j/k;
p=q/r;
If q=7.2, r=20, j=3, k=2
The value of a and p is
(A) a=1.5, p=3.6 (B) a=2, p=3
(C) a=1.5, p=4 (D) a=1, p=3
Ans: C
a=3/2=1.5 and p=q/r=7.2/2=3.6 is rounded off to 4.
Q.46 Choose the function that returns remainder of x/y -
(A) remainder( ) (B) mod( )
(C) modulus( ) (D) rem( )
Ans: C
AC05 Programming & Problem Solving Through ‘C’
AC06 Data Structures
10
modulus( ) function produces the reminder of an integer division.
Q.47 What is the output of following program:-
int q, *p, n;
q = 176; If the address of q is 2801
p = &q; and p is 2600
n = *p;
printf(“%d”, n);
(A) 2801 (B) 176
(C) 2600 (D) None of the above
Ans: B
n is assigned a the value which is present at the address of q and that value is 176.
Q.48 Consider the following statementsx
= 5;
y = x >3 ? 10 : 20;
The value of y is
(A) 10 (B) 20
(C) 5 (D) 3
Ans: A
Since x=5 is greater than 3 so y is assigned value 10. It is equivalent to if-else
statements.
Q.49 Determine which of the following is an invalid character constant.
(A) ‘\a’ (B) ‘T’
(C) ‘\0’ (D) ‘/n’
Ans: D
newline character constant is “\n” not “/n”.
Q.50 What is the name of built-in function for finding square roots?
(A) square(x) (B) sqr(x)
(C) sqrt(x) (D) No built-in function
Ans: C
sqrt(x) is a built-in function for finding square roots.

No comments:

Post a Comment