UPSC Exam  >  UPSC Notes  >  Mathematics Optional Notes for UPSC  >  Computer Programming

Computer Programming | Mathematics Optional Notes for UPSC PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


Edurev123 
6. Computer Programming 
6.1 Find the values of two valued Boolean variables ?? ,?? ,?? ,?? by resolving the 
following simultaneous equations : 
???
+???? ?=?? ???? ?=????
???? +?? ???
+???? ?=???
?? 
where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
Solution: 
???
+???? =0
? (???
+?? )(?? +?? ) =0
? 1·(???
+?? ) =???
+?? =0
 It means ???
+?? =0
? ???
=0 and ?? =0
?? =1 and ?? =0
 
??1·(???
+?? )=???
+?? =0?[??? +???=1&1·?? =?? ] 
Put this values in second equation, i.e. 
???? ?=????
1.?? ?=1.?? ?? ?=?? =0
 
Put values of ?? ,?? &?? in third equation, i.e., 
???? +?? ???
+???? ?=???
?? 1.0+1.0
¯
+0.?? ?=0
¯
?? 0+1+0?=1.?? =?? ?? ?=1
 
6.2 (i) Realize the following expression by using NAND gates oniy : ?? =(???+???
+
?? )???
(???+?? )?? where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
(ii) Find the decimal equivalent of (357.32) . 
(2009 : 6 Marks) 
Solution: 
Page 2


Edurev123 
6. Computer Programming 
6.1 Find the values of two valued Boolean variables ?? ,?? ,?? ,?? by resolving the 
following simultaneous equations : 
???
+???? ?=?? ???? ?=????
???? +?? ???
+???? ?=???
?? 
where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
Solution: 
???
+???? =0
? (???
+?? )(?? +?? ) =0
? 1·(???
+?? ) =???
+?? =0
 It means ???
+?? =0
? ???
=0 and ?? =0
?? =1 and ?? =0
 
??1·(???
+?? )=???
+?? =0?[??? +???=1&1·?? =?? ] 
Put this values in second equation, i.e. 
???? ?=????
1.?? ?=1.?? ?? ?=?? =0
 
Put values of ?? ,?? &?? in third equation, i.e., 
???? +?? ???
+???? ?=???
?? 1.0+1.0
¯
+0.?? ?=0
¯
?? 0+1+0?=1.?? =?? ?? ?=1
 
6.2 (i) Realize the following expression by using NAND gates oniy : ?? =(???+???
+
?? )???
(???+?? )?? where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
(ii) Find the decimal equivalent of (357.32) . 
(2009 : 6 Marks) 
Solution: 
(i) So 
?? (?? ,?? ,?? ,?? )=(???+???
+?? )???
(???+?? )?? =?? ·?? ·???
¯¯¯¯¯¯¯¯¯¯
???
?? ·???
¯¯¯¯¯¯
?? =???????? =????????¯¯¯¯¯¯¯¯
 
Now the expression by NAND gates will be 
 
This is the required circuit. 
(ii) (357.32) )
8
 to decimal conversion 
(357.32)
8
?=3×8
2
+5×8
1
+7×8
0
+3×8
-1
+2×8
-2
?=(192+40+7+0.375+0.03125)
10
?=(239.40625)
10
 
6.3 If ?? ??? =?? ?? '
+?? '
?? . Find the value of ?? ??? ??? . 
(2010 : 6 Marks) 
Solution: 
Given : 
?? ??? ?=?? ?? '
+?? '
?? ?? ??? ??? ?=(?? ?? '
+?? '
?? )??? ?=?????? +?? '
???? +(?? ?? )
'
·(?? '
?? )
'
?? ?=?????? +?? '
???? +(?? '
+(?? )
'
)·((?? '
)
'
+?? )?? ?=?????? +?? '
???? +(?? '
+?? )·(?? +?? )?? ?=?????? +?? '
???? +(?? '
?? +?? '
?? +???? +?? ·?? )?? ?=?????? +?? '
???? +(0+?? '
?? +???? +0)?? ?=???? ?? '
+?? '
???? +?? '
?? ?? +?????? ?=?????? +?????? +?? '
???? +?? '
?? ?? '
 
6.4 (a) Find the hexadecimal equivalent of the decimal number (???????????? )
????
 
(2010 : 5 Marks) 
(b) For the given set of data points 
(?? ?? ,?? (?? ?? )),(?? ?? ,?? (?? ?? )),…(?? ?? ,?? (?? ?? )) 
Page 3


Edurev123 
6. Computer Programming 
6.1 Find the values of two valued Boolean variables ?? ,?? ,?? ,?? by resolving the 
following simultaneous equations : 
???
+???? ?=?? ???? ?=????
???? +?? ???
+???? ?=???
?? 
where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
Solution: 
???
+???? =0
? (???
+?? )(?? +?? ) =0
? 1·(???
+?? ) =???
+?? =0
 It means ???
+?? =0
? ???
=0 and ?? =0
?? =1 and ?? =0
 
??1·(???
+?? )=???
+?? =0?[??? +???=1&1·?? =?? ] 
Put this values in second equation, i.e. 
???? ?=????
1.?? ?=1.?? ?? ?=?? =0
 
Put values of ?? ,?? &?? in third equation, i.e., 
???? +?? ???
+???? ?=???
?? 1.0+1.0
¯
+0.?? ?=0
¯
?? 0+1+0?=1.?? =?? ?? ?=1
 
6.2 (i) Realize the following expression by using NAND gates oniy : ?? =(???+???
+
?? )???
(???+?? )?? where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
(ii) Find the decimal equivalent of (357.32) . 
(2009 : 6 Marks) 
Solution: 
(i) So 
?? (?? ,?? ,?? ,?? )=(???+???
+?? )???
(???+?? )?? =?? ·?? ·???
¯¯¯¯¯¯¯¯¯¯
???
?? ·???
¯¯¯¯¯¯
?? =???????? =????????¯¯¯¯¯¯¯¯
 
Now the expression by NAND gates will be 
 
This is the required circuit. 
(ii) (357.32) )
8
 to decimal conversion 
(357.32)
8
?=3×8
2
+5×8
1
+7×8
0
+3×8
-1
+2×8
-2
?=(192+40+7+0.375+0.03125)
10
?=(239.40625)
10
 
6.3 If ?? ??? =?? ?? '
+?? '
?? . Find the value of ?? ??? ??? . 
(2010 : 6 Marks) 
Solution: 
Given : 
?? ??? ?=?? ?? '
+?? '
?? ?? ??? ??? ?=(?? ?? '
+?? '
?? )??? ?=?????? +?? '
???? +(?? ?? )
'
·(?? '
?? )
'
?? ?=?????? +?? '
???? +(?? '
+(?? )
'
)·((?? '
)
'
+?? )?? ?=?????? +?? '
???? +(?? '
+?? )·(?? +?? )?? ?=?????? +?? '
???? +(?? '
?? +?? '
?? +???? +?? ·?? )?? ?=?????? +?? '
???? +(0+?? '
?? +???? +0)?? ?=???? ?? '
+?? '
???? +?? '
?? ?? +?????? ?=?????? +?????? +?? '
???? +?? '
?? ?? '
 
6.4 (a) Find the hexadecimal equivalent of the decimal number (???????????? )
????
 
(2010 : 5 Marks) 
(b) For the given set of data points 
(?? ?? ,?? (?? ?? )),(?? ?? ,?? (?? ?? )),…(?? ?? ,?? (?? ?? )) 
Write an algorithm to find the value of ?? (?? ) by using Lagrange's interpolation 
formula. 
(2010 : 10 Marks) 
(c) Using Boolean algebra, simplify the following expressions: 
(i) ?? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +? 
(ii) ?? '
???? +???? +???? where ?? '
 represents the complement of ?? . 
(2010 : 5 Marks) 
Solution: 
(a) Given number is (587632)
10
. 
??(587632)
10
=(8?? 770)
16
 
(b) The algorithm is written below: 
1. Read ?? 1
?? 
2. For ?? =1 to (?? +1) in steps of 1 do read ?? ?? ,?? (?? ?? ) end for 
3. For ?? =1(?? +1) in steps of 1 do 
4. Prod func ?1 
5. For ?? =1 to (?? +1) in steps of 1 do 
6. If (?? ???) then 
16 587632 0 
16 36727 7 
16 2295 7 
16 143  F 
16 8 8 
 0  
 
prod func ? prod func ×
(?? -?? ?? )
(?? ?? -?? ?? )
 
end for 
Page 4


Edurev123 
6. Computer Programming 
6.1 Find the values of two valued Boolean variables ?? ,?? ,?? ,?? by resolving the 
following simultaneous equations : 
???
+???? ?=?? ???? ?=????
???? +?? ???
+???? ?=???
?? 
where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
Solution: 
???
+???? =0
? (???
+?? )(?? +?? ) =0
? 1·(???
+?? ) =???
+?? =0
 It means ???
+?? =0
? ???
=0 and ?? =0
?? =1 and ?? =0
 
??1·(???
+?? )=???
+?? =0?[??? +???=1&1·?? =?? ] 
Put this values in second equation, i.e. 
???? ?=????
1.?? ?=1.?? ?? ?=?? =0
 
Put values of ?? ,?? &?? in third equation, i.e., 
???? +?? ???
+???? ?=???
?? 1.0+1.0
¯
+0.?? ?=0
¯
?? 0+1+0?=1.?? =?? ?? ?=1
 
6.2 (i) Realize the following expression by using NAND gates oniy : ?? =(???+???
+
?? )???
(???+?? )?? where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
(ii) Find the decimal equivalent of (357.32) . 
(2009 : 6 Marks) 
Solution: 
(i) So 
?? (?? ,?? ,?? ,?? )=(???+???
+?? )???
(???+?? )?? =?? ·?? ·???
¯¯¯¯¯¯¯¯¯¯
???
?? ·???
¯¯¯¯¯¯
?? =???????? =????????¯¯¯¯¯¯¯¯
 
Now the expression by NAND gates will be 
 
This is the required circuit. 
(ii) (357.32) )
8
 to decimal conversion 
(357.32)
8
?=3×8
2
+5×8
1
+7×8
0
+3×8
-1
+2×8
-2
?=(192+40+7+0.375+0.03125)
10
?=(239.40625)
10
 
6.3 If ?? ??? =?? ?? '
+?? '
?? . Find the value of ?? ??? ??? . 
(2010 : 6 Marks) 
Solution: 
Given : 
?? ??? ?=?? ?? '
+?? '
?? ?? ??? ??? ?=(?? ?? '
+?? '
?? )??? ?=?????? +?? '
???? +(?? ?? )
'
·(?? '
?? )
'
?? ?=?????? +?? '
???? +(?? '
+(?? )
'
)·((?? '
)
'
+?? )?? ?=?????? +?? '
???? +(?? '
+?? )·(?? +?? )?? ?=?????? +?? '
???? +(?? '
?? +?? '
?? +???? +?? ·?? )?? ?=?????? +?? '
???? +(0+?? '
?? +???? +0)?? ?=???? ?? '
+?? '
???? +?? '
?? ?? +?????? ?=?????? +?????? +?? '
???? +?? '
?? ?? '
 
6.4 (a) Find the hexadecimal equivalent of the decimal number (???????????? )
????
 
(2010 : 5 Marks) 
(b) For the given set of data points 
(?? ?? ,?? (?? ?? )),(?? ?? ,?? (?? ?? )),…(?? ?? ,?? (?? ?? )) 
Write an algorithm to find the value of ?? (?? ) by using Lagrange's interpolation 
formula. 
(2010 : 10 Marks) 
(c) Using Boolean algebra, simplify the following expressions: 
(i) ?? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +? 
(ii) ?? '
???? +???? +???? where ?? '
 represents the complement of ?? . 
(2010 : 5 Marks) 
Solution: 
(a) Given number is (587632)
10
. 
??(587632)
10
=(8?? 770)
16
 
(b) The algorithm is written below: 
1. Read ?? 1
?? 
2. For ?? =1 to (?? +1) in steps of 1 do read ?? ?? ,?? (?? ?? ) end for 
3. For ?? =1(?? +1) in steps of 1 do 
4. Prod func ?1 
5. For ?? =1 to (?? +1) in steps of 1 do 
6. If (?? ???) then 
16 587632 0 
16 36727 7 
16 2295 7 
16 143  F 
16 8 8 
 0  
 
prod func ? prod func ×
(?? -?? ?? )
(?? ?? -?? ?? )
 
end for 
8. Sum ? sum +?? (?? ?? )× Prod func end for 
9. Write ?? ,sm 
10. Stop 
(c) (i) ?? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +.. 
Now, ??? +?? '
?? =?? (1+?? )+?? '
?? =?? +???? +?? '
?? 
=?? +y(?? +?? '
)=?? +?? ·1 
???? +?? '
?? =?? +?? 
Similarly, ??? +?? '
?? +?? '
?? '
?? =?? +?? +?? 
??? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +?=?? +?? +?? +?? +? 
(ii) ?? '
?? '
?? +???? +???? 
?=?? (?? '
?? '
+?? )+????
?=?? (?? '
?? '
+?? (?? +?? '
))+????
?=?? (?? '
?? '
+???? +?? '
?? )+????
?=?????? +?? (?? '
?? '
+?? '
?? )+????
?=?????? +?? '
?? +????
?=???? ?? +?? (?? +?? '
)=?????? +?? ?=?? (1+???? )=?? 
6.5 (a) Compute (3205) )
????
 to the base 8. 
(b) Let ?? be an arbitrary but fixed Boolean algebra with operations ?,?? and' and 
the zero and the unit element denoted by 0 and 1 respectively. Let ?? ,?? ,?? ,……. be 
elements of ?? . 
If ?? ,?? ??? be such that ?? ??? =?? and ?? ??? =? then prove that ?? =?? '
. 
(2011 : 12 Marks) 
Solution: 
(3205)
10
 to be base 8 . 
 
??(3205)
10
=(6205)
8
 
Page 5


Edurev123 
6. Computer Programming 
6.1 Find the values of two valued Boolean variables ?? ,?? ,?? ,?? by resolving the 
following simultaneous equations : 
???
+???? ?=?? ???? ?=????
???? +?? ???
+???? ?=???
?? 
where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
Solution: 
???
+???? =0
? (???
+?? )(?? +?? ) =0
? 1·(???
+?? ) =???
+?? =0
 It means ???
+?? =0
? ???
=0 and ?? =0
?? =1 and ?? =0
 
??1·(???
+?? )=???
+?? =0?[??? +???=1&1·?? =?? ] 
Put this values in second equation, i.e. 
???? ?=????
1.?? ?=1.?? ?? ?=?? =0
 
Put values of ?? ,?? &?? in third equation, i.e., 
???? +?? ???
+???? ?=???
?? 1.0+1.0
¯
+0.?? ?=0
¯
?? 0+1+0?=1.?? =?? ?? ?=1
 
6.2 (i) Realize the following expression by using NAND gates oniy : ?? =(???+???
+
?? )???
(???+?? )?? where ??? denotes the complement of ?? . 
(2009 : 6 Marks) 
(ii) Find the decimal equivalent of (357.32) . 
(2009 : 6 Marks) 
Solution: 
(i) So 
?? (?? ,?? ,?? ,?? )=(???+???
+?? )???
(???+?? )?? =?? ·?? ·???
¯¯¯¯¯¯¯¯¯¯
???
?? ·???
¯¯¯¯¯¯
?? =???????? =????????¯¯¯¯¯¯¯¯
 
Now the expression by NAND gates will be 
 
This is the required circuit. 
(ii) (357.32) )
8
 to decimal conversion 
(357.32)
8
?=3×8
2
+5×8
1
+7×8
0
+3×8
-1
+2×8
-2
?=(192+40+7+0.375+0.03125)
10
?=(239.40625)
10
 
6.3 If ?? ??? =?? ?? '
+?? '
?? . Find the value of ?? ??? ??? . 
(2010 : 6 Marks) 
Solution: 
Given : 
?? ??? ?=?? ?? '
+?? '
?? ?? ??? ??? ?=(?? ?? '
+?? '
?? )??? ?=?????? +?? '
???? +(?? ?? )
'
·(?? '
?? )
'
?? ?=?????? +?? '
???? +(?? '
+(?? )
'
)·((?? '
)
'
+?? )?? ?=?????? +?? '
???? +(?? '
+?? )·(?? +?? )?? ?=?????? +?? '
???? +(?? '
?? +?? '
?? +???? +?? ·?? )?? ?=?????? +?? '
???? +(0+?? '
?? +???? +0)?? ?=???? ?? '
+?? '
???? +?? '
?? ?? +?????? ?=?????? +?????? +?? '
???? +?? '
?? ?? '
 
6.4 (a) Find the hexadecimal equivalent of the decimal number (???????????? )
????
 
(2010 : 5 Marks) 
(b) For the given set of data points 
(?? ?? ,?? (?? ?? )),(?? ?? ,?? (?? ?? )),…(?? ?? ,?? (?? ?? )) 
Write an algorithm to find the value of ?? (?? ) by using Lagrange's interpolation 
formula. 
(2010 : 10 Marks) 
(c) Using Boolean algebra, simplify the following expressions: 
(i) ?? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +? 
(ii) ?? '
???? +???? +???? where ?? '
 represents the complement of ?? . 
(2010 : 5 Marks) 
Solution: 
(a) Given number is (587632)
10
. 
??(587632)
10
=(8?? 770)
16
 
(b) The algorithm is written below: 
1. Read ?? 1
?? 
2. For ?? =1 to (?? +1) in steps of 1 do read ?? ?? ,?? (?? ?? ) end for 
3. For ?? =1(?? +1) in steps of 1 do 
4. Prod func ?1 
5. For ?? =1 to (?? +1) in steps of 1 do 
6. If (?? ???) then 
16 587632 0 
16 36727 7 
16 2295 7 
16 143  F 
16 8 8 
 0  
 
prod func ? prod func ×
(?? -?? ?? )
(?? ?? -?? ?? )
 
end for 
8. Sum ? sum +?? (?? ?? )× Prod func end for 
9. Write ?? ,sm 
10. Stop 
(c) (i) ?? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +.. 
Now, ??? +?? '
?? =?? (1+?? )+?? '
?? =?? +???? +?? '
?? 
=?? +y(?? +?? '
)=?? +?? ·1 
???? +?? '
?? =?? +?? 
Similarly, ??? +?? '
?? +?? '
?? '
?? =?? +?? +?? 
??? +?? '
?? +?? '
?? '
?? +?? '
?? '
?? '
?? +?=?? +?? +?? +?? +? 
(ii) ?? '
?? '
?? +???? +???? 
?=?? (?? '
?? '
+?? )+????
?=?? (?? '
?? '
+?? (?? +?? '
))+????
?=?? (?? '
?? '
+???? +?? '
?? )+????
?=?????? +?? (?? '
?? '
+?? '
?? )+????
?=?????? +?? '
?? +????
?=???? ?? +?? (?? +?? '
)=?????? +?? ?=?? (1+???? )=?? 
6.5 (a) Compute (3205) )
????
 to the base 8. 
(b) Let ?? be an arbitrary but fixed Boolean algebra with operations ?,?? and' and 
the zero and the unit element denoted by 0 and 1 respectively. Let ?? ,?? ,?? ,……. be 
elements of ?? . 
If ?? ,?? ??? be such that ?? ??? =?? and ?? ??? =? then prove that ?? =?? '
. 
(2011 : 12 Marks) 
Solution: 
(3205)
10
 to be base 8 . 
 
??(3205)
10
=(6205)
8
 
6.6 Find the logic circuit that represents the following Boolean function. Find also 
an equivalent simpler circuit : 
 
(2011: 20 marks) 
Solution: 
The given Boolean function is 
?? (?? ,?? ,?? )=?? ·?? ·?? +???·?? ·?? 
The logic circuit is : 
 
6.7 Draw a flow chart for Lagrange's interpolation formula. 
(2011 : 20 Marks) 
Solution: 
Flow chart for Lagrange's interpolation formula : 
Read More
387 videos|203 docs

Top Courses for UPSC

FAQs on Computer Programming - Mathematics Optional Notes for UPSC

1. What is computer programming?
Ans. Computer programming is the process of designing and building an executable computer program for accomplishing a specific computing task.
2. Why is computer programming important?
Ans. Computer programming is important because it enables us to create software applications, websites, and other digital tools that improve efficiency, automate tasks, and solve complex problems.
3. What are some popular programming languages used in computer programming?
Ans. Some popular programming languages used in computer programming include Python, Java, C++, JavaScript, and Ruby.
4. What skills are required to become a successful computer programmer?
Ans. To become a successful computer programmer, one needs to have strong problem-solving skills, attention to detail, logical thinking, and proficiency in programming languages.
5. How can someone learn computer programming?
Ans. One can learn computer programming through online tutorials, coding bootcamps, college courses, and practice. It is essential to start with a simple programming language and gradually move on to more complex ones as skills improve.
387 videos|203 docs
Download as PDF
Explore Courses for UPSC exam

Top Courses for UPSC

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

video lectures

,

Exam

,

past year papers

,

Computer Programming | Mathematics Optional Notes for UPSC

,

Semester Notes

,

shortcuts and tricks

,

Objective type Questions

,

Summary

,

Sample Paper

,

ppt

,

pdf

,

Extra Questions

,

mock tests for examination

,

Free

,

Viva Questions

,

Computer Programming | Mathematics Optional Notes for UPSC

,

Computer Programming | Mathematics Optional Notes for UPSC

,

Important questions

,

Previous Year Questions with Solutions

,

practice quizzes

,

study material

,

MCQs

;