0% found this document useful (0 votes)
3 views49 pages

Advanced Programming

The document contains examination questions for M.E (EE) and M. Tech (EE) courses focusing on computational methods and programming in electrical engineering. It includes problems on LU factorization, interpolation, numerical methods, UNIX programming, and object-oriented programming concepts. Students are required to answer questions from specified groups, covering both theoretical and practical aspects of the subjects.

Uploaded by

Debu Jana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views49 pages

Advanced Programming

The document contains examination questions for M.E (EE) and M. Tech (EE) courses focusing on computational methods and programming in electrical engineering. It includes problems on LU factorization, interpolation, numerical methods, UNIX programming, and object-oriented programming concepts. Students are required to answer questions from specified groups, covering both theoretical and practical aspects of the subjects.

Uploaded by

Debu Jana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

pN,) r(

M.E (EE) 1st Semester Final Examination 2016


Computational Methods and Programming in Electrical Engineering
(EE s17)

Time : 3 Hours Full Marks : 70

Answer any TWO questions from GrouyA and THHEE questions from Group-B

GROUP-A

1. (a) Solve the following set of equations with LU factorization:


3x1-2x2+1, = -10
2x1+67, -4*, = 44
-x1- 2x2+ $13 = -26

(b)
x 0.8 0.9 1.0 1.1 1.2
f(x) 0.71736 0.78333 0.84147 0.923L4 0.96356

L.2

Evaluate I f {*1a*
o.a
Use (a) Simpson's L/3 rule, @) Trapezoidal rule

[8+6]

2. (a) Using the following table evaluate Vt55 using Lagrange's interpolation
formula.

x 150 152 L54 156


v=Vx 12.247 t2.329 L2.410 12.490

(b) Fit a line to the fo data:


Year (x) 1951 1961 L97L 1981 1991
Production I 10 t2 10 16
(y): in
thousand
tons

[7+7)

3. (a) dy/dx =11+y2), y(0) =0. Find y(0.6) using Runge-Kutta 4ft order method.
Choose Step size h =0.2.

(b) Solve the following set of equations using Gauss elimination technique.

4x1+31r-X:=-2
'2xt- 4xz + Sxg = 20
Xt*2xz+6xs=7
[6+B]
GROUP-B

4. (a) Explain redirection operator, pipe and filter of UNIX shell with suitable
illustration.

(b) Discuss about the various development tools of UNIX/LINUX programming


environment. (9+5)

5. (a) What is Object Oriented Programming? Write note on it.

(b) Define "static" and "dynamic" binding. Write a C++ program to demonstrate
"late" binding. (5+9)

6. (a) Explain user defined data type in C/C++ using a suitable example.

(b) Write a C/C++ code to add naro mahices of compiex numbers, where real and
imaginary parts are expressed in rational form. (5+9)

7. (a) ) Discuss about UNIX process and process system commands.

(b) Write brief notes on: (t) gdb (ii) gnuplot (iii) gprof (5+9)

8. Write short notes on following topics: (5+5+4)


(a) Revision Control System
O) UNIX Scheduler
(c) Write a C program to find out the root of f (x) = e-*- x = 0using bisection
method up to 3 decimal correct value. Use appropriate preprocessor directives, header
files and functions.
1
l,l

Indian Institute of Engineering Science and Technolos/, Shibpur


M. Tech (EE) 1st Semester Final ExaminalioE, November 2017
Advanced Computation and Numerical Methods (EE 904)

Time: 3 Hours Full Marks : 70

Answer any TWO questions from Group-A and THRXE questions from Group-B

Group-A

1. (a) The voltagev across a capacitor at time t seconds is given by the followilg
table. Use the pdnciple o{ least squares to fit a curve of the Joml v=aek to the data.

t (sec) 0 2 4 6
V (volts) 150 63 12 5.6

(b) Solve using Gaussia! Elimtuation


xl+x,+rk+x4=2
xr + x, +3X!-2& = -6
2(1+3xr-x3+2q=7
xr+2xr+](3-&:-2

[7+71

2. (a) A rocket is Iaunched from the ground. Its acceleration, f is registered during the
fust B0 secs ard it is given ir the table below. Usitrg SiEpson,s U3'd rule, ftud &e
velocity of the rocket at t=80 se.s.

t secs 0 10 20 30 40 50 60 70 80
f: 30 31.63 35.47 37.75 40.33 46.69 40.67
crdsec2

@) Solve the following set of equations lrsing LU factodzation

1,0x+ y+7 =12


2x +10y+z =13
2x +2y + 102 - 14 [6+8]

3. (a) Using Newtor's Fomula fiDd {(22) and (42) using rhe following data:

x 20 25 30 40 45
f(x) 3S4 332 291 260 231 204

(b) dyldx = logr0 (x+y), y(0) =2. Srep size h =0.2. Find y(0.2) using Modified
Euter,s
method.
[B+6]

GROUP.B

4. (a) What is meant by developers' tool urder UNIX,4-INUX? Discuss about revision
contlol system and debugger of tools in a brief.
(b) How redirection opeEtors and pipes are used in UNIIVLINIJX? Give examples of
each g?es of operato$.
(c) What is clontab? Exaplain it in detail. (5+5+4)

5. (a) Define "Object'and "Class".


(b) What is "inheritance"? Write a bdef Ilote on its advantages and disadvantages
(c) Iind out the elrols in the following code a[d explain the eirors.
#include <stdio.h>

dass TkoDPoiDt
{
public:
int x,yi
void setx(int a) { x=a; }
void setY(int a) { y=a; }
irt getx0 { retum x; }
i.nt getY0 { return y; }
):

dass ThreeDPoint : pivate T\\,oDPoint


{
protected:
il1t z;
void setz (iDt a){ z=a; }
iDt getz 0 { retum z; }
);
int mah0{
TkoDPoint a,b;
TbreeDPoint c,d;
a.setx(1);a.setY(1);
b=a;
printf("The 2D point B is (%d,%d)\tr",b.gelxo,b.getYo);
c.setx(1);c.setY(1); c.setz(2);
d=c;
pintf("The 3D point D ls (7od,%d,o/"d)\n",d.getxo,d.getYo,d.getzo);
returrl 0;
l
(2+(2+3)+7)
6. (a) What is etrcapsulation? How it is enforced in a C++ prograE?
(b) Develop a C++ header for "Rational" Numbers-

(c) Explaio templated dass in C++ with an appropriate example. (3+6+5)

7. W te shoft notes on following topics (4+5+5)


(a) Output of "ls -1" command.
(b) OpenMPI and MPICH library
(c) "Static" and 'Dynamic" binding.
6N'?-W''li

Indian Institute of Engineering Science and Technology, Shibpur


M. Tech (EE) 1st Semester Final Examiratio& November 2018
Subject Advanced Computation and Numerical Methods (EE 904)

Time: 3 Hours Full Marks: 70

Answer any TWO questions ftom GROTP-A and any THREE questions from GROUP-B

GROUP.A

(a) Use R-K 4th order method to solve the following equation.
.
;=,1, I t'0, = I . Find ) I0 . 2 , . Take srep size h =0. I.

(b) Use Gauss-Jordan elimination to solve the following set ofequations


4x1 +3Yr-1, =6
xt +X2 +X3 = 1
3xr + 5xu+ 3xr =4
17+'7)

2.(a) Find f(x) as a polynomial in x from the given data and then find f(8). Use Lagrange's
Interpolation techrique.

x 3 7 9 l0
f(x) 168 120 172 63

(b) Solve the following set ofequations using LU factorization


2xr - x2txl =_1
3xl + 3x2+9x3 :0
3xr + 3x2+5x3 :4
[6+8]

3. (a) Find the values of a, b, c so that Y=a+bc+cx2 is the best fit to the following data:

0 2 3 4
1 0 3 10 2l

(b) Evaluate J ;;l; using trapezoidal rule taking h =0.25

l8+61

Page l of3
GROUP-B

(Question No 4 is compukory. Ansh/er any t\4o frcm the rest')

4. Explain the purpose ofthe important functions and steps Lrsed in the following code

#include <mpi.h >


#include <math.h>
#include <stdio.h>

float fct(float x)
{
retum cos(x);
)

float integral(float a, int n, float h);

void main(int argc, char *argv[)


{
int n, p, i, j, ien, num;
float h, result, a, b, pi;
float my_a, my_range;
int myid, source, dest, tag;
MPl Status status;
float my_result;

pi: acos(-1.0);
a=0.j
b=pi* t. /2.;
n = 100000;
dest:0;
ta:g = 123;

MPI Init(&argc, &argv);


MPI Comm rankMPI COMM WORLD, &myid);
MPicomm-sizeliwl coMM-woRrD, &p);
h=(b-a)/n;
num=n/p;
my_range=(b-a)/p;
my a = a + myid * my,range;
my_result : integal(my-a, num, h);

printf("Process oZd has the partial result ofolofln", myid, my result);

if (myid =:0) {
result: my_result;

Page 2 of3
for(i=l;i<p;i+r){
source = i;

MPl_Recv(&my-result, 1, MPI_REAL, source, tag, MPI-COMM-WORLD,


&status);
result += my_result;
)
prird("Th€ result =yofln", result);
) else
MPl-S€nd(&my-resulr, l, MPI_REAL, dest, tag, MPI_COMM-WORLD);

MPlFinalizeQ;
]
float integral(float a, int n, float h)
{
int j;
float h2, aii, integ;
integ = 0.0;
h2=h t2.;
for (i= 0;j < n;j++) {
arj=afj*h;
integ += fct(aij + h2) * h;
)
.etum (integ);

o4)

5. (a) W te briqfnotes on redirection operators, pipe and filtereof UNIX shellprogram with
suitable examples.
(b) Discuss about development tool's under UNIX/LINUX. (6+8)

6. (a) Discuss about user defired data types in CyC++.


O) Define virtual function, pure v tu.l firnction 8nd abstract class with
appropriate illustrations. (6+8)

7. Write short notes on any two ofthe following topics (1rJ)


(a) Debugger
O) Unix processes and relevont command$
(c) Find any one root off(x): xr - x + I = 0 using bisection method uP to 3 decimal
correct value.

Page 3 of3
nglu'W

rndian rnstitute of Engineering science and rechnology, shibpur


B.E. Part-w@E)-old / B.Tech. (EE)-Exft 7th semester Final Examination,
November 2017

Advanced Programming F or Electrical Engineering


I EE-706/2 (Old) @lective-fr) I EE-7ZL/L @tecriye III) ]

Time:3-hours FuIl Marks : 70

Use separate answer-scnpt for each haH.

Aaswer SD( questions, taking THREE from each half.

Two marks are reserved for neatness in each half.

FIRST EALF

1. Determine the number of multiplications, divisions and fill-ins required for the LU
factorisation of mah-ix corresponding to the gaph shown in Fig-l. (11)

2- (a) write the [A] matrix corresponding to the gaph shown in Fig. 2. (2)

ft) Using Ordering scheme 1, re-order the matix and find out the number of fiIls that
will occur during LU factorisation of [A]. Clearly describe the interrnediate steps to
justify your answer. (9)

3, (a) Explain the foilowing in the context of parallel processing.

(i) Speed-up, (ii) Efficiency and (ii) Granuiarity (6)

(ii) What will


be the speed-up and efficiency of computation if 10 numbers are to be
added using 5 parallel processors instead of sequentiai execution of the additions of
the numbers using a single processor. Draw necessary directed acyclic graphs to
j"stify your answer. (5)

4- (a) What are the differences between parallel processing and dish-ibuted processing?
(s)
(b) Fourprocessors Pr, Pz, Pr and P+ hold 12 data as shown in column 2 of Table-1.
Explain how Odd-Even Transportation Sort algorithm can be used to sort the numbers
in ascending order so the processors finally hold the data as shown in the third colurrn
of the Table.

Table: 1

Processor Initial Data Finai Data


Pr 7, 12.6 1)?
Pz s.8. 10 4.5.6
Pr 3,1, 11 7.8.9
Pa Q L) i0. 11. 12

(o

5. (a) In connection with an Operating System explain the following:

(i) Process Scheduier, (ii) Inter Process Communication @C) Manager, (iii)
Scalabiiity and (iv) Portabiiity. (o
ft) Explain with a suitable example how a sparse matrix is stored in compact form
using Row Linked List technique. (5)

SECOND HALF

6. Load test data of V, 0.5KVA, 50Hz tansformer is given below


a singie phase 220/55
a) Design a SQL table to store this infonnation and populate it with this data.
b) Expiain the data type for each field.
c) Compute the efficiency and regulation at each row and then compute the average
efficiency and regulation using SQL.

Primary Side Secondary Side I

Voltmeter Ammeter Wath-neter Voltneter Ammeter Wattneter Efficiency Regulation


SL Reading Keadmg Reading Reading Reading Reading (%) (Yt
No

ar
V A w A W

1 220 0.14 4 54 0 0

2 220 0.20 16 <i 0.30 16.2


F9 T

trg -t
,2.
3 220 0.60 r28 s4 2.2 I 18.8

4 220 0.78 168 54 3.0 162

5 220 1.22 264 54 4.7 253.8

6 220 1.68 360 54 6.5 351

(5+2+4)

7. a) What is a view? Why should you use a view?


b) What is the purpose of the eondition operators BETV/EEN and iN?
c) What is the default ordering of data using the ORDER BY clause? How could it be
changed?
d) What are the specific uses of SQL functions? (3+4+Z+Z)

8. a) What is the difference between right join and selfjoin? Explain it with an example.
b) What's wrong in the following query?
D SELECT subject code, count (name)
FROM students;
ii) SELECT subject code, AVG (marks)
FROM students
WHERE AVG(marks)> 75
GROUP BY subject code;
c) Say True or False. Correct it if the answer is False: .

COUNT(*) returns the number of columns in a table. (5+2x2+Z)

9 a) Define client and server side scripting{anguages.


b) How PF{P is different from Javascript language? Explain the relationship among
Ffn\4L, PHP, Javascript, CSS and database system used in web programming.
c) Write an appropriate code to retieve data form a PostgreSQl table using PEIP.
(2+6+3)

10. Write brief notes on the following topics: (3+4+4)


a) TCP/IP suite
b) Mulfi-tire architecture of Web Application
c) PRIIvIARY KEY and FOREIGN KEY in a database.
21"k8

Indian Institute of Engineering Science and Technolog5r, Shibpur


B.Tech. (EE)-Exit 7t Semester Final Examtratio[ November 2018

Advanced Programming in Electrical Engineering


EE-72U1 (Elective [I)

Time: 3-hours Full Marks : 70

Use separate answer-soipt for each half.

Answer SIX questions, taking THREE from each half

Two marks ale reserved for neamess in each half.

FIRST IIALF

1. (a) Justily the lollowing statef0enl

"Unfke direct medods, *le amount of computations required by an iterative Eethod


is not fixed; it depenals on the accuracy deEanded by the user. "

O) Ushg causs Seidel method carry out 5 iterations to solve the Iollowing.

17 Xr + 65X, - 13 X3 + 50 Xa= 8a
12 Xl+ 16X' +37X3+18Xa=25
55Xr+23X, + 11X3 - 19Xa= 36

3X' -5X, + 47 Xr+10X4=18


(3+8)

2. (a) Using power medrcd detemire the dominart eigeD value and con€sponding eigen vector
ofde Iolowing naEix [A].
Il0 -2 11
lAl=l-z Lo -zl
Ii 10l -2
(b) Find &e maEn [Dr] whose doEinant eigen value will be (he second dominant eigen value
of tAl- (7+4)

Page 1of 4
3. (a) In coNrection wili conculrent processing explain ihe following terms with the help of a
simple example.

(i) Speed-up, (ii) EfficiencY

(b) Explain how you would imPletnent Odd - Even transpo(ation sort algoriiim to arrange
the following numbers in ascending order.

7,3,6.s,A,1-,4,2 (4+7\

4. (a) Clearly explain the difference beMeen Parallel Processing and DisEibuted Protessing.

(b) Explain the folowmg terns.

(i) Granularity, (ji) Overhead, (iii) Load Batancing, (iv) Socket, (v) I er Process
Communication (IPC) Manager (6+s)

5. (a) Fig. 1 shows &e gaph of an electric cAftit with 5 nodes (excluding the reference nod€).
Determine the degree of sparsity of the nodal admittance [laEix [A] of ihjs circuit

O) If [A] is to be factorised into a lower trlangular natrix [L] and an upper Eiangular loatrix
lul and their e]€nents are stored i! [Q] where [Q] = [L] + [U] - [I], where [I] is an identiry
matrix, determine the following

(i) number of nultiplications ard divisions to be carried out.

(ii) number oI Iillins that will occur.

(c) Suggest a melhod to reduce the number of fill-ins; justiff your answer.

(2+s+2+2)

FiBure- r

Pag,e 2 o{ 4
SECOND ITALF

6. Explain the pupose of ttre important functions and steps used in ihe following code-

#include <[lpi.h >


*include <math.h>
#in.lude <stdio.h>

float fct(float x)
{
rerum cos(x);
i
float iltegral(float a, int 4 floath);

void Elain(inr argc, cllar *argv[])


(
int n, p, i, i, ierr, nuu
float b, resull a, b, Pi;
Iloat Ey_a, my-Iange:
int Eyid, sourcq dest. tagj
MPI-Status status;
float Dy-result;

\pi = acosCl.0);

b =pi * 1,/ 2.;


n = 100000;
dest = 0;
tag = 123

MPI lDit(&arec, &argv);


MPI-CoEn-rank(MPI-COMM-WORLD, &myid);
MPI-ComE-size(MPI-COMM-WORLD, &P);

h=(b-a)/n;
my-range=(b-a)/P;
my_a : * my-range;
a + myid
Ey-result = htegral(my-a, Dum, h);

printl("Process %d has tie partial result of %4n", Eryid, my-result);

if (Eyid == 0) {
result = Ey-result;

for (i = 1;i < P; i++) {

MPl-Recv(&my-result, 1, MPI-RIAL, source, tag, MPI-COMM-WORLD'


&status)i
result += my-result;
)
prind('The resutt =%fln", result)j

Page 3 of4
) else
MPI-Send(&Ey_resU1t, 1, MPI-REAL, dest, tag, MPI-COMM-WORLD);

MPl_Finalizeo;
)

floar integral(float a, int n, float h)


{
intj;

float h2, alj, integ;


integ = 6.6'

for (j = 0;j < n;j++) {


aij=a+j*h;
inreg +: fc(aii + h2) * h
)
rerum (inte8);
(11)

7. (a) what is RDBMS? How PRIMARY KEY and FOREIGN KEY are used? Explain witi suitable
example'
(b) Give an exaopie where a sub-query and a JoIN produce sa6e rcsull ((2+a) + 5)

8. (a) What is user defined function in SQL? write a small code segment aod €xplain it
(b) What is oigger? How a Eigg€r is different froo user defined fuction? Explain it with sLritable
example. (5+6)

9 (a) \ahy and how DNS and DHCP are used? ExPlain.

(b)Draw different coEponents ofLAN and WAN with their interconnections.

(c) wrire shon notes on: HTML, Serve. Site Scripting, CSS and digital signatrc.
(4+3+4)

10. write b.ief notes on thp folowirg topics: (3+4+4)

a) IP numbers and its sub-classes.

b) Multi-tire architectue oI Web APplication

c) Write the full form oI DDL, DML and DCL and give some examples of respective S QL
f?
{- v(nlt+

Indian Institute of Engineering Science and Technolory Shibpur


B.E. 7e Semester (EE) Final Examination,20l6

Advanced Programming For Electrical Engiaeering


(Efr7ffin) @hctive I[)
Time:3-hours ,ull Marks: 70
,
Use separate answer-script for each half

Answer SD( questions, taking THREE from each half

Two rharks are reseryed for neatress in each half

FIRST HALF

l. Two spame matrices A and B are stored in compact form using row linked list
technique as follows.

ForA:
A_row_starting

3 4 2 5 7
A value

2 3 I 7 4 2 6
A col no
4lr 4 3 3 2 2
A link
0 0 6 0 I 0 0

For B:

B_row_starting

2 5 7 I
B value

7 6 9 3 J 5 2
B col no

3 4 J 5 5 I 2

7
B link
4 6 0 0 0 0 3

(i) Obtain C = A.B and express it in compact form using row linked list
technique. (8)

(ii) Determine the number of mathematical operations that could be saved by this
technique instead of storing the matrices in conventional method. (3)

2. (i) What is meant.by dominant eigen value? (2)

(ii) Find the dominant eigen value and corresponding eigen vector of the
following matrix by Power method.

1 I J
1 5 1

J 1 1

Use the following as the starting vector.

0
0
I
(s)

(iii) Find the next dominant eigen value and the coresponding eigen vector by
Shifting technique. (4)

3 (i) Explain (a) speed-up and (b) efficiency in connection with parallel processing
(4)

(ii) Suppose the numbers 14, 6, 12,70,16,2,8,4 are held by eight processors Ps,
Pz, ....., P8 connected linearly. Explain how Odd Even Transportation,Sorf can be
used to arrange these numbers in ascending order so that smallest number is in
Pr, the second smallest is in Pz and so on. (7)

4. (D What is the role of Operating Systems? Draw a diagram explaining the


structure of an Operating System. (2 + 3)

(ii) Which Operating System components perform (a) write to disk, (b) determine
which process will run next, (c) determine where in memory a new process
should be placed, and (d) organise files on disk. (2)

2
(iii) What is the difference between a program and a process? Draw a diagram
showing different process states and transition from one to another. (4)

5. (i) What is the difference between a co-operating process and an independent


process? What are reasons for providing an environment that allows process co-
operation? (2 + 3)

(ii) Explain (a) Inter-process Communication, (b) Message switching, (c) Packet
switching. (6)

SECOND HALF

6. (a) What is sub-query? How IN and NOT IN clauses are used in SQL queries?

(2+s)
(b) Write brief notes on the following SQL commands/clause with appropriate
examples

CREATE TABLE, DELETE, DROP and GROUP BY (lxa)

7. (a) What is RDBMS? How PRIMARY KEY and FOREIGN KEY are used?
Explain with suitable examples. (2+4)

(b) Give an example where a sub-query and a JOIN produce ru*. r.rrr,.
,r,

8. (a) What is user defined function in SQL? Write a small code segment and explain
it. (s)
(b) What is trigger? How a trigger is different from user defined function - explain
it with suitable example. (6)

9. (a) What are full forms of DNS and DHCP? Explain the DNS and DHCP services

(2+s)

(b) Write a brief note on TCP/IP suite. (4)

10. Write brief notes on the following topics: (4+4+3)

(a) Client and server side scripting

(b) Multi-tire architecture of Web Application

(c) Basic operators and data types in SQL

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy