c programming

3

Click here to load reader

Upload: dezyneecole

Post on 14-Jun-2015

51 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: C programming

Dezyne E’Cole College, Ajmer

B.C.A (Part 1) Examination, 2013Fundamental of C Programming

1. What will be the output of the following codeint x=40000;

printf (“%d”, x);

Ans: Garbage value

2. Arrange following operators in ascending order according to their precedence.a. &&b. ||c. !d. ? :e. & (Bitwise)

Ans: !, &, &&, ||, ? :

3. What will be the output of following code for

(i=1, j=10; i<6; ++i, j--)

printf (“%d %d”, i, j);

Ans:

4. What is the meaning of

int (*P)[10];

Ans: P, Array of pointer (10 values)

5. What is the meaning of

int *P [10];

Ans: P, 10 array of pointer, that stores 10 different addresses.

6. Find errors (if any) and remove them otherwise give output of the following

I J

1 10

2 9

3 8

4 7

5 6

Page 2: C programming

Dezyne E’Cole College, Ajmer

Char C=’A’;

int x=10, y;

y=x+c;

putchar(y);

Ans: char C=’A’;

int x=10,y;

y=x+C;

putchar(y);

Output: K

7. Find errors and remove them (if any) otherwise give output of the following

printf(“%d”,++5);

Ans: printf(“%d”,5);

output: 5

8. Find errors and remove them (if any) otherwise give output of the following

printf[“%d”,sizeof(“”)];

Ans: printf(“%d”,sizeof(“”));

output: 1

9. What will be the output of the following:

int x=10, y=20;

(x>y)? ++x: ++y;

printf(“\n x=%d, y=%d”,x,y);

Ans: x=10, y=21

10. if student structure is given as

struct student

{

char name[10];

Page 3: C programming

Dezyne E’Cole College, Ajmer

int E;

int H;

int M;

}*pstu;

then allocate memory to pstu pointer.

Ans: pstu= (student*) malloc (sizeof (student));