written 5.1 years ago by |
Structured Programming Approach - May 18
First Year Engineering (Semester 2)
Total marks: 80
Total time: 3 Hours
INSTRUCTIONS
(1) Question 1 is compulsory.
(2) Attempt any three from the remaining questions.
(3) Draw neat diagrams wherever necessary.
1.a.i. Which bitwise operator is used to multiply the number by 2n where n is number of bits.
A] Bitwise-OR
B] Bitwise-AND
C] Bitwise Left shift
D] Bitwise Right Shift
1.a.ii. Which operator has the lowest priority?
A] ++
B] %
C] +
D] ||
1.a.iii. Which of these is a valid variable declaration?
A] int emp salary; B] float marks_student; C] float roll-no; D] int main;
1.a.iv. What will be the output of the following program?
void main ( ) {
double x=28;
int r;
r= x%5;
printf ("\n r=%d", r);
}
A] r= 3
B] Run time Error
C] Compile time Error
D] None of the Above
1.a.v. What will be the output of the program
void main() {
int X []= {10,20,30,40,50};
print f (" \n %d %d %d %d ", x [4] ,3[x] ,x[2] ,l[x] ,x[0] );
}
A] Error
B] 10 20 30 40 50
C] 50 40 30 20 10
D] None of these
1.a.vi. Which of the following is not a keyword of 'C' ?
A] auto
B] register
C] int
D] function
1.a.vii. What will be the output?
void main ( ) {
int y;
y=0xl0+ 010+10;
printf ("\ny=%x", y);
}
A] y = 34
B] x = 34
C] y = 22
D] Error
1.a.viii. Study the following C program
void main () {
int a= 0;
for ( ; a ;); a++;
}
What will be the value of the variable a, on the execution of the above program.
A] 1
B] 0
C] -1
D] none of these
1.a.ix. Which of the following is used as a string termination character?
A] 0
B] \0
C] /0
D] None of these
1.a.x. What will be the output of the following program code?
void main ( ) {
char a[]= "Hello World" ;
char *p ;
p=a;
printf("\n%d %d %d %d", sizeof(a), sizeof(p), strlen(a), strlen(p) );
}
A] 11 11 10 10
B] 10 10 10 10 10
C] 12 12 11 11
D] 12 2 11 11
i. Size of pointer variable is equal to the datatype it points to.
ii. A float constant cannot be used as a case constant in a switch statement.
iii. The statement void p; is valid.
iv. while {0); is an infinite loop.
v. scanf() function is used to input string having multiple words
vi. A function can have any number of return statements.
vii. In a union, space is allocated to every member individually.
viii. An algorithm is a graphical representation of the logic of a program.
ix. Comments in the program make debugging of the program easier.
x. There is no difference between '\0' and '0'.
$1 + 2^2 + 3^3 + ... + n^n$
i) break and continue statements
ii) if-else and switch statements
1) main() { int a,b,pl,p2,x,y; a=48;b=lO;pl=&a;p2=&b; x=pl *p2-8; pl=pl+p2; y=(pl/*p2)+20; printf("%d %d %d %d %d %d", *pl, *p2,a,b,x,y); }
2) main() {
int x=4,y=9,z;
z = x++ + --y +y;
printf("\n %d %d %d",x,y,z); z= --x + x+ y--;
printf("\n %d %d %d",x,y,z);
}
- i. Create a 2D array (Matrix) [in main function]
- ii. Write a function to read 2D array(Matrix)
- iii. Write a function that will return true(l) if entered matrix is symmetric or false(0) is not symmetric.
- iv. Print whether entered matrix is symmetric or not [ in main function]