West Bengal Institute of Technology (WBIT) 2009-2nd Sem B.Tech Electronics and Communications Engineering Electronics
Full Marks : 70
INTRODUCTION TO COMPUTING-2009
i
10x1=10
i) Which one of the following declaration isinvalid ?
(a) int 2A (b) int A2A (c) in A2 (d) int AA2
ii) Which one is the right output ? . .
int x = 9 ; |
printf(%d\ ++x); else
printf(%d, jc++); .... ... , :
ia) 9 (b) 10 (c) 11 - (d) 12
iii) Which one is the right output ?
char a [50] = computer ; . .
printf(%d, strlen(a));
(a) 9 (b) 10 (c) 8 . (d) 11
iv) Which one is the right output ? .
#define int char
mainO
{ ' int / = 65;
printf(sizeof(i)=%d, sizeof(i)); .
} " , ' . .
(a) sizeof(i)=l (b) sizeof(i)=2 <c) sizeof(i)=4 (d) sizeof(i)=8
v) Which one is the right output ? . main()
{ : = ' int i = 5, / = 6, z;
printf(%<5?, H- -w-/);
(d) 13
(c) 11
(a) 12
(b) 10
vi) In Hexadecimal number system, E is equivalent to the number in decimal
(d). 15
(c) 14
(a) 10
(b) 12
vii) What is the range of unsigned short int ?
(a) 0 to 65535 (b) 0 to 255 (c) - 128 to 127 (d) none
viii) Operating system is <t .
(a) Application Software (b) System Software (c) Firmware (d) None of these
ix) ALU is a part of
(a) Memory (b) CPU (c) Output device (d) Input device.
x) Member of a union uses
(a) different storage location (b) same storage location
(c) no storage location , (d) none of these
xi) What will be the value of i and m after executing the following code ? int/=l,m;
. m = i ++; ,
(a) 6, 5 (b) 5, 5 (c) 5, 6 (d) 6, 6 '
Ans. (i) a ; (ii) b ; (iii) c ; (iv) b ; (v) a ; (vi) c ; (vii) b ; (viii) b ; (ix) b ; (x) b ; (xi) 2, 1.
Group - B (Short Answer Type Questions)
Answer any three of the following. 3x5 = 15
2. (a) Convert (f7-25)10 to Binary. 1
(b) What are 2s compliment numbers ? How do you use this system to perform (51)10 - (27)10 in binary? 1+2
(c) What are the main differences between RAM & ROM? 1 Ans. (a)
(17-25)]0 = (?)2 : ' ' ; , -
Q R '
17-2 = 8 1 8-2=4 0
4-2=2 0 , '
2-2=10 r .
1-2 = 0 i ' ; ,
(17)10 = (10001)2
-25 x 2 = 0-50 lst Part O .
-50 x 2 = 1-00 1st Part 1 - .
('25)10 = (01)2 . :
(17-25)jq = (10001 -07)2 .
Ans. (b) Binary Numbers are represented two ways- j -
- (l)Fixe$ Point* (2);Floating Point. ' --.*
Fixed point number can be represented in three ways-
(1) Sign magnitude, (2) ls Complement, (3) 2,s Complement.
(5)|0 = (00000101), => [0]0000]01 (8 bit represent)
'I' '
" Sign bit
11 I 1 1 0 I 0
rs
Complement
2s -
Complement
1 I 1 1 1 0 1 0
+ 1
111110 11
-5 in 2s complement
(51), = (00110011), (27)10- (00011011),
Vs
Complement
ation)-
2s Complement
0 0 0 11 0 11
1110 0 10 0
+1
1110 0 10 1
Sign bit - QTjO 110 0 11 =>+51 in 2s complement.
Sign bit -> [T! 1 1 0 0 I 0 1 = 0 27 in complement.
1 0 0 0 110 0 0 complement
Discorded + 24
in 2s complement
Ans. (b) see the answer of 2005 Q.no 1(b). 1
Ans. (c) RAM |
hom |
Random Access Memory |
Read Only Memory |
i. Random Access Memory |
i. Read only Memory |
ii. Read and write Memory |
ii. Read only |
iii. Volatile Memory |
iii. Non volatile Memory |
(a) What is ternary operator? Explain with example.
2+1
2
(b) Write down the differnece between compiler and interpreter.
Ans. (a) See the answer of 2002, Q.no 6(c).
Ans. (b) See the answer of 2005, Q.no 3(b).
(b) Write a flowchart to find the sum of the all integers ranging from 100 to 200 and divisible by both 2 and 3.3
Ans. (a) See the answer of 2003 Q.no, 3(a).
Briefly describe the function of different components of a convertional digital computer with a suitable block diagram. 5
5.
Ans. See the answer of 2002 Q.no 3(a).
Write a C program to find out the GC.D of two numbers. 5
6.
Ans. See the answer of 2002 Q.no 5(b).
' Group - C (Long Answer Type Questions) Answer any three of the following.
3 x 15 =45
7. (a) Differentiate between do-while and while statements with suitable examples. 4
(b) Differentiate between break and continue statement with example.
(c) What is the difference between structure and union in C programming Supplement with examples.
(d) Explain recursion with an example.
Ans. (a) See the answer of 2002 Q.no 4(c).
Ans. (b) See the answer of 2004 Q.no 10(iii).
Ans. (c) See the answer of 2005 Q.no 4(a). .
Ans. (d) See the anser of 2003 Q.no 4(b).
8. (a) Write a C program to check whether a given number is prime number or not. 5
(b) Write a program to compute factorial of a number read from keyboard. 4
(c) What are auto, external and static variables ? Explain their uses with suitable examples. 6
Ans. (a) '
# include < stdio.h >
# include < eonio.h > void main()
{ .'i . . ' . int num. i. f = 0;
Printf("\n Enter the number");
Scanf("%d", B num);
fat (i = 2: i < = num t I; i++) :
} . if {num % i = = Q)
, ; f = l; -' break:
} * ; '
} , if (f==0) ; :
Printf ("\n The number is f rime"): ;
else : ' ; , ..... . ; .. -
Printf ("\n The number is not Prime"): . .
getch(); . ' . .
} , ..
Ans. (b) See the answer of 2006 Q.no, 5 -
Ans. (c) See the answer of 2002 Q.no, 7(b).
9. (a) What is array of pointers ? Explain with example.
(b) Explain call by value and call by reference with examples. c
(c) Write a progr&n in C to find the real roots of a quadratic equation using usei defined functioft Quad( ). , i I '
Ans. (a) See the ME9wer of2002 Q.no,. 8(ii).
Ans. (b}jee tjhe answer of 2003 Q.no, 8(a).
Ans. (c) |
; # include <stdio!h> , *
# include <conioih>
void Quod (float, flqat, flQfK); void main()
I * * v ' It
float' a, tit;
Prihtf f\n Enter thjJp-eff a, b>ciifequ"axA2 + bx + c"):
Scanf(ff%f%f%f,%4b.4c); .
* Quod (a, b, c);
getchf); ,
} ' ' ' void Quad (float a, float b, float c);
{ . ' .. ... float d; .
d = b*b-4*a*c ; // dis cr mirates if (d==D)
Printf ("\n Two read and equalroots are root = % f and root2 = % t".
else it (d>Q) \
Printf ("\n Two real and unequal roots are root l=%f and root ;
else !
Printf ("\n Imaginary roots"); . !
getch(); , ' :
} . ... ::
10. (a) Explain two input Exclusive OR gate using truth table. 2y
(b) Why NAND gate is called univfkal gate? 2y
(c) Simplify : (A + B).(A.C) + (A.B + A.C).(A + D) ' A
. (d) Convert:
i) (2 AD)8 = ( )2
ii) (11100111101), - ( )I6
iii) (25*125)ie = ( )2. I
Ans. (a)
=AB+AB g, n)D A 0 B ,
' A B A B I
0 0 0 /
Ans. (b) NAND gate is universal gate be cause by NAND gate w can unplement any type of boolean enpression or circuit. 1
Ans. (c) (A + D)(AC) + (AB + AC)(A + d) !
A AC + BAC + O + ACAD
Q R traction int Part Part
25 + 2* 12 1 -125 x 2 = -250 0
AC(l + B) + ACD
AC+ACD Ans. (dXO (2AD)16 = (?)2 |
(in)(25 125), = (?)2 = (11001 :001)2 |
12 + 2 = 6 0 -250 x 2= -5 0
6-2=30 -5 x 2 = -01
3+2 = 1 1 (-25)10 = (001)2
(25)10 = (11001),
11. Write short notes on any three of the following : 3 x 5
(a) Void pointer and null pointer . , .
(b) Dynamic memory allocation function
(c) Function prototype
(d) Bitwise operator
(e) Macro.
Ans. (a) Vpid Pointer : Void pointer is a pointer which can point to any type of data or can hold any type of address. *
Null Pointer : Null pointer is a pointer which holds the NULL.
Ans. (b) See the answer of 2005, Q.no 8(c).
Ans. (c) Function Proto type : Whenever user want to create any function then user has to daclare the function as follows :
int mult (int, int);
return type function name argument type
Compiler want this declaration. This function declaration is called function prototype. Ans. (d) See the answer of 2003 Q.na 12(ii).
Ans. (e) See the answer of 2004 Q.no 12.
Attachment: |
Earning: Approval pending. |