0% found this document useful (0 votes)
64 views

CSA Practical List (Python)

This document appears to be a computer science assignment submitted by Vivek Kumar to Dr. Divya Gupta at Deen Dayal Upadhyaya College, University of Delhi. It contains 10 questions related to computer system architecture and bitwise operations. For each question, Vivek has provided the question prompt, a short Python program to demonstrate the concept, and an explanation of the program's output. The questions cover topics like binary to decimal conversion, left/right bit shifting, logical operators, one's/two's complement, bitwise addition, and selective set/clear logical operations.

Uploaded by

HARDIK 21PCS5114
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

CSA Practical List (Python)

This document appears to be a computer science assignment submitted by Vivek Kumar to Dr. Divya Gupta at Deen Dayal Upadhyaya College, University of Delhi. It contains 10 questions related to computer system architecture and bitwise operations. For each question, Vivek has provided the question prompt, a short Python program to demonstrate the concept, and an explanation of the program's output. The questions cover topics like binary to decimal conversion, left/right bit shifting, logical operators, one's/two's complement, bitwise addition, and selective set/clear logical operations.

Uploaded by

HARDIK 21PCS5114
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

[DEEN DAYAL UPADHYAYA COLLEGE]

(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 -

Decimal Value Binary Value


Left shift - 8808 01000100110100
Right Shift- 137 1001001
[Question No_3 ]
Write a program that will prompt for the input of two integer values.Then
using the logical operators show the result of :-
a)Exclusive OR of the first number by the second bitwise.
b)OR of the first number by the second bitwise.
c)AND of the first number by the second bitwise.

-: 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 ]

You might also like