Computer Science
Answer
(a) 10010
Binary No | Power | Value | Result |
---|---|---|---|
0 (LSB) | 20 | 1 | 0x1=0 |
1 | 21 | 2 | 1x2=2 |
0 | 22 | 4 | 0x4=0 |
0 | 23 | 8 | 0x8=0 |
1 (MSB) | 24 | 16 | 1x16=16 |
Equivalent decimal number = 2 + 16 = 18
Therefore, (10010)2 = (18)10.
(b) 101010
Binary No | Power | Value | Result |
---|---|---|---|
0 (LSB) | 20 | 1 | 0x1=0 |
1 | 21 | 2 | 1x2=2 |
0 | 22 | 4 | 0x4=0 |
1 | 23 | 8 | 1x8=8 |
0 | 24 | 16 | 0x16=0 |
1 (MSB) | 25 | 32 | 1x32=32 |
Equivalent decimal number = 2 + 8 + 32 = 42
Therefore, (101010)2 = (42)10.
Related Questions
Assertion (A): In Python, a variable can hold values of different types at different times.
Reason (R): Once assigned, a variable's data type remains fixed throughout the program.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): Python lists allow modifying their elements by indexes easily.
Reason (R): Python lists are mutable.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Draw a logical circuit for the following equations:
(A+B)C
AB'+C'
Observe the code given below and answer the following questions:
n = ............... #Statement 1 if ............... : #Statement 2 print ("Please enter a positive number") elif ............... : #Statement 3 print ("You have entered 0") else: ............... #Statement 4
(a) Write the input statement to accept n number of terms — Statement 1.
(b) Write if condition to check whether the input is a positive number or not — Statement 2.
(c) Write if condition to check whether the input is 0 or not — Statement 3.
(d) Complete Statement 4.