Professional Documents
Culture Documents
CP Ec03 2021
CP Ec03 2021
Comprehensive Examination
(EC-3 Regular)
Q.1Set.(A) A calorie is a unit of energy. The 15° C calorie is defined as 4.1855 Joules. The
following script defines a couple of random calorie values, calls a function to
calculate the equivalent number of Joules, and prints this. Write the function, and
store it in a separate code file [7]
Q.1Set.(B) Write a function called rotleft that will receive one row vector as an argument (you
may assume that it is a row vector with a length of at least two), and will return
another vector, which consists of the input vector rotated to the left – e.g., all values
shift over one element, and the first element is wrapped around to the end. For
example, >> rotleft([1 3 4]) [7]
Q.1Set.(C) Write a function isdivby4 that will receive an integer input argument, and will return
logical 1 for true if the input argument is divisible by 4, or logical false if it is not.
[7]
Q.2Set.(A) DNA is a double stranded helical polymer that contains basic genetic information in
the form of patterns of nucleotide bases. The patterns of the base molecules A, T, C,
and G encode the genetic information. Construct a cell array to store some DNA
sequences as character vectors, such as
TACGGCAT
ACCGTAC
and then sort these alphabetically. Next, construct a matrix to store some DNA
sequences of the same length and then sort them alphabetically. [7]
Q.2Set.(B) Create a cell array of all character vectors. Sort them alphabetically. Investigate the
use of some string functions on the cell array, e.g., lower, count, and contains.
[7]
Q.2Set.(C) Create a table to store information on students; for each, their name, id number, and
major (say chemical, mechanical,etc) [7]
Q.3Set.(A) A production facility is producing some nails that are supposed to have a diameter of
0.15 inch. At five different times, 10 sample nails were measured; their diameters
were stored in a file that has five lines and 10 diameters on each. First, create a data
file to simulate this data. Then, write a script to print the mean and standard deviation
for each of the five sets of sample nails. [7]
Q.3Set.(B) The operations manager of a plant that manufactures tires wants to compare the
actual inner diameters of two grades of tires, each of which is expected to be 575
millimeters. A sample of five tires of each grade was selected, and the results
representing the inner diameters of the tires, ranked from smallest to largest, are as
follows:
Grade X 568 570 575 578 584
Grade Y 573 574 575 577 578
Create a data file tire.xls in Excel and calculate the mean, median and std. dev in
MATLAB and export it to excel or write the computed values to excel [7]
Q.3Set.(C) Enter and save the data shown below in excel in a spreadsheet, then import the data
in MATLAB and find the mean of each row, this data to be reflected in excel sheet
also
55 42 98
49 39 95
63 51 92
58 45 90
Also, find the additional values in MATLAB for std deviation of each column in
MATLAB [7]
Q.4Set.(A) The following list gives the measured gas mileage in miles per gallon for 22 cars of
the same model. Plot the absolute frequency histogram and the relative frequency
histogram.
23 25 26 25 27 25 24 22 23 25 26
26 24 24 22 25 26 24 24 24 27 23
[7]
Q.4Set.(B) Calculate and plot two subfunctions on same page in MATLBA for the following two
functions
[7]
Q.4Set.(C) Plot a three-dimensional figure for this equation, also plot the contours of these
equation and explain the significance of this commands [7]
Q.5Set.(A) Create a data structure to store information about the elements in the periodic table of
elements. For every element, store the name, atomic number, chemical symbol, class,
atomic weight, and a seven-element vector for the number of electrons in each shell.
Create a structure variable to store the information, for example for lithium:
Lithium 3 Li alkali-metal 6.94 2 1 0 0 0 0 0 [7]
Q.5Set.(B) Create a data structure to store information about the elements in the periodic table of
elements. For every element, store the name, atomic number, chemical symbol, class,
atomic weight, and a seven-element vector for the number of electrons in each shell.
Create a structure variable to store the information, for example for
sodium:
Sodium 11 Na alkali-solid 22.98 2 8 13 0 0 0 0 [7]
Q.5Set.(C) Create a data structure to store information about the elements in the periodic table of
elements. For every element, store the name, atomic number, chemical symbol, class,
atomic weight, and a seven-element vector for the number of electrons in each shell.
Create a structure variable to store the information, for example for
Carbon:
Carbon 6 C element-gas 12 2 8 2 0 0 0 0 [7]
Q.6Set.(C) Two variables store character vectors that consist of a letter of the alphabet, a blank
space, and a number (in the form ‘R 14.3’). Write a script that would initialize two
such variables. Then, use functions to extract the numbers from the character vectors
and add them together [5]
********