CCS 3275 Scientific Computing Cat 2-1
CCS 3275 Scientific Computing Cat 2-1
Object Oriented Programming – objects are the key element of the paradigm
and the codes are re-usable.
Functional Programming – everything is bind in pure mathematical functions
style and it uses declarations over statements
Procedural Programming – a series of computational steps are divided to
modules i.e the code is grouped in functions and the code is serially
executed step by step.
The paradigm focuses more on what to solve rather than how to solve hence
helping solve a problem effectively in a simpler way.
i. Functional programming follows declarative programming model
whereas OOP does follows imperative programming
ii. Functional programming uses recursion for iteration while OOP uses
loops for iteration
iii. OOP has access specifiers i.e public, private and protected whereas
functional programming does not have any access specifier.
iv. Functional programming supports parallel programming, OOP on the
other hand does not support parallel programming.
3. Identify the two classes of I/O functions and distinguish between them using
relevantexamples in program segments. (4marks)
math.cos
Import math
A = math.pi/6
Print (“Value pi/6 is : “,end = “”)
Print(math.cos(A))
Open the CSV file for writing (W mode) by using the open() function
Create a CSV writer object by calling the writer() function of the CSV module
Write data to CSV file by calling the Writerow() or Writerows() method of the
CSV writer object.
Close the file once you complete writing data to it
8. What is the output of the program segment? Explain by tracing the segment
(2marks)
# Python program explaining
# bitwise_or() function
import numpy as geek
in_num1 = 10
in_num2 = 11
print ("Input number1 : ", in_num1)
Input number2 : 11
bitwise_or of 10 and 11 : 11
9. Explain why Pandas are the most powerful data analysis tool in Python
Programming and scientific computing
Pandas is powerful and easy to use on open source tool specifically used
for data analysis and manipulation. Pandas is built on the Numpy package
and its key data structure is called the dataframe. Pandas is mainly used for
data manipulation, visualisation of the data, building machine learning
tools etc. There are two main data structures in pandas that is series and
daraframes.