Slideshow

Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Monday, 25 February 2013


Q.10 The second expression (j – k) in the following expression will be evaluated
(i + 5)&&(j – k)
(A) if expression (i + 5) is true.
(B) if expression (i + 5) is false.
(C) irrespective of whether (i + 5) is true or false.
(D) will not be evaluated in any case.

Q.10 The second expression (j – k) in the following expression will be evaluated
(i + 5) && (j – k)
(A) if expression (i + 5) is true.
(B) if expression (i + 5) is false.
(C) irrespective of whether (i + 5) is true or false.
(D) will not be evaluated in any case.

Q.9 Consider the following code segment:
int a[10], *p1, *p2;
p1 = &a[4];
p2 = &a[6];
Which of the following statements is incorrect w.r.t. pointers?
(A) p1 + 2 (B) p2 – 2
(C) p2 + p1 (D) p2 – p1

Q.8 The content of file will be lost if it is opened in
(A) w mode (B) w+ mode
(C) a mode (D) a+ mode

Q.7 Choose the correct answer
(A) enum variable can not be assigned new values
(B) enum variable can be compared
(C) enumeration feature increase the power of C
(D) None of the above

Q.6 Consider the following declaration
int a, *b = &a, **c = &b;
The following program fragment
a = 4;
**c = 5;
(A) does not change the value of a (B) assigns address of c to a
(C) assigns the value of b to a (D) assigns 5 to a

Q.5 If x is one dimensional array, then pick up the correct answer
(A) *(x + i) is same as &x[i] (B) *&x[i] is same as x + i
(C) *(x + i) is same as x[i] +1 (D) *(x + i) is same as *x[i]

Q.4 What is the output of the following program?
main ( )
extern int x;
x = 20;
printf(“\n%d”, x);
}
(A) 0 (B) 20
(C) error (D) garbage value

Q.4 What is the output of the following program?
main ( )
{ extern int x;
x = 20;
printf(“\n%d”, x);
}
(A) 0 (B) 20
(C) error (D) garbage value

Q.3 What is the following program doing?
main ()
{ int d = 1;
do
printf(“%d\n”, d++);
while (d < = 9);}
(A) Adding 9 integers (B) Adding integers from 1 to 9
(C) Displaying integers from 1 to 9 (D) None of these

Q.2 Choose the correct one
(A) Address operator can not be applied to register variables
(B) Address operator can be applied to register variables
(C) Use of register declaration will increase the execution time
(D) None of the above




Q.1 What is the output of the following program?
main ( )
{ int x = 2, y = 5;
if (x < y) return (x = x+y); else printf (“z1”);
printf(“z2”);
}
(A) z2 (B) z1z2
(C) Compilation error (D) None of these

In ______, the difference between the height of the left sub tree and height of the right
tree, for each node, is almost one.
(A) Binary search tree (B) AVL - tree
(C) Complete tree (D) Threaded binary tree


How does an enumstatement differ from a typedef statement? 

Explain the following file functions.
(i) fgetc( ) (ii) ftell
(iii) fgets( ) (iv) rewind( )
(v) fseek (5)
Ans:

Explain path testing. 


Q.71 Write a program to find the highest of three numbers using pointer to function. 6)

Can a structure be used within a structure? Give appropriate examples to support
your answer


Distinguish between the functions islower() and tolower(). (2)
Ans:

Are the following statements valid? Justify your answer
(i) k = (char*)& m
(ii) m= (float*)& p (4)
Ans: