CSA Practical List (Python)
CSA Practical List (Python)
(UNIVERSITY OF DELHI)
VIVEK KUMAR
-:ASSIGNMENT:-
COMPUTER SYSTEM
ARCHITECTURE
Submitted by : -
[Vivek Kumar]
Submitted to :- Roll No :-
[Dr. Divya Gupta] [21PCS5140]
[[email protected]]
[Question No_1 ]
Write a program to convert an unsigned number in one radix ‘A’ to the
equivalent number in another radix ‘B’,where A and B can be any positive
integer.
-: Program :-
-: OUTPUT :-
Here we can see that in first line – “Enter a number : ” , here we enter -
1010 (in the form of binary number) ,
And also we know that the base of binary number is 2 , if we enter binary
number so we will gave the base of second line is 2 .
Next line we will enter we want to change in (on the base of base of
number) in our case we will enter 10 (base of decimal number )
Finally it will give the anwer 10 because-
=[(2^0)*0+(2^1)*1+(2^2)*0+(2^3)*1
=0+2+0+8
=10 Ans
[Question No_2 ]
Question :- Write a program that will prompt for the input of two integer
values.Then using the Bitwise Operator shift operator show the
result of : -
a)Left shifting the first number by the second number.
b)Right shifting the first number by the second number.
-: Program :-
A) First Part.
B) Second Part.
-: OUTPUT :-
A) First Part.
first of all it will come to prompt for enter value from the user in the form
of Decimal Or Binary [if user enter decimal first of all our program will
change into Bianry form after that it will perform our operation (in our case
Left Shift) ]if user enter Binary number so it will perform as it is but answer
will come in decimal form as well as bianry form .
B) Second Part.
first of all it will come to prompt for enter value from the user in the form
of Decimal Or Binary [if user enter decimal first of all our program will
change into Bianry form after that it will perform our operation (in our case
Right Shift ]if user enter Binary number so it will perform as it is but
answer will come in decimal form as well as bianry form.
Here we can see that if we enter 1101 in both case and number of shifting is
3 so -
-: Program :-
-: OUTPUT :-
a) Exclusive-OR :-
First of all our program take two intput from the user and store in further
variable num1 and num2 .
After that it will show the option what will do the user like perform
XOR,OR or AND . Operation.
b) OR :-
c) AND :-
[Question No_4 ]
Write a program that will prompt for the input of a binary value and
print :-
a)One’s Complement
b)Two’s Complement
-: Program :-
-: OUTPUT :-
[Question No_6 ]
Write a program to implement bit-wise addition of two numbers .
-: Program :-
-: OUTPUT :-
[Question No_8 ]
Write a program to implement Selective Set logical operation using bit-
wise operators.
-: Program :-
-: OUTPUT :-
[Question No_10 ]
Write a program to implement Selective Clear logical operation using bit-
wise operators.
-: Program :-
-: OUTPUT :-
[ THANK YOU ]