0 ratings0% found this document useful (0 votes) 226 views21 pagesComputer Programming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
© eames i eas
INSTITUTE OF ENGINEERING Level BE | Full Marks / 80
Examination Control Division | Programme] aise. 8.Avi) | Puss Mark [32
2078 Astin Heeliee tin 5
Y Caniidates‘are required to give their answers in their own words as far as practicable,
¥ Aitempt All questions.
¥ The figures in the margin indicate Full Marks
¥ Assume suitable data if necessary,
1. What are computer programs and computer programming? Explain the steps that are
required to build a computer program for solving a certain problem.
2. Explain with an example the role that precedence and associativity play in the execution
of an expression. Rewrite the following program by correcting any errors, if present anid
also write down the output of the corrected code.
Define MAX’S*
rinth"Case %d = 93.2¢\n" easel);
sum +=" caset;
&
average = sumn/MAx;
printf("%606.2F" average);
return 4;
)
a) Compare if-else-if ladder and switch construct with example and flowchart,
b) Write 2 program in C to generate following pattern using unformatted inpuvvoutput
functions only,
ewe
7
aa
LELLLELLE
4. Write a program in C to find out whether the n'” term of the Fibonacci series is a prime
number or not. Read the value of n from the user and display the result in the main
function. Use separate user-defined functions to generate the n® Fibonacci term and to
check whether a number is prime or not
[2+6]
(4)
(3)
(1a) How two dimensional arrays are created in C programming? Write a program to read
square matrix of size Nx and find sum of both diagonals. ea]
‘by Write a program in C to check whether a given string is palindrome or not using user
defined funetio
4)
‘What are the advantages of using pointer in C programming? Weite a program in C to
find, socond largest clements fiom an array containing N elements using concept of
pointer.
[24]
Explain structures and nested structures? Create a structure to hold any complex number
xtiy. Write a program that uses the structure to read two complex numbers and display a
third complex number which is the multiplication of the entered complex numbers.
a) What are different input/output functions used with data files in C? Explain with
syntax and examples.
B45]
(4
'b) Write a program in C to read integers from user until user says “no”. After reading the
data write all the odd numbers to a file name odd.txt and all the even number to file
named even.txt. 5
‘ i)
9. When can we use recursive functions? Why do we need control statements in computer
programs? Differentiate between do...while and for statements. [Reza]
0. What are the characteristics of FORTRAN Programming? Write a program in FORTRAN
to calculate the value of x by evaluating the following formula for the first 25 terms.
@)o TRIBHUV AN UNIVERSITY Exam,
STITUTE OF ENGINEERING Level Full Marks | 80
Examination Control Division | Programme | All (Except B. Arch) Pass Marks 32
2074 Chaitra Year/Part__ 1/1
Subject: - Computer Programming (CT#01)
rime 3 hrs.
Candidates are required to give their answers in their own words as far as practicable.
Attempt All questions:
The figures in the margin indicate Full Marks:
Assume suitable data if necessary.
AWA
a) What is a programming language? What is the difference between source code and
object code. (2+2]
b) What is debugging and testing? What are the step that need to be followed for
developing the application software. (2421
2. a) What is the difference between variable declaration and variable definition? Explain
with example, 14]
b) What do you mean by macro expansion and file inclusion in C? Explain. with
example, 4]
What are functions used for formatted end unformatted output? Write down its syntax.
Write down the output of prinif() fmetion for the following sections of statements. (4+4q
float a 891:
int b = 6789;
print{("a=Me4f and b=%-7d from first line", a,b);
prinif("a=%-7.2f and b=%07d from second line", a,b);
printfi"a=%.2f and b=%2d from third line”, a,b);
4. a) Explain about while loop with its syntax and flowchat (4)
b)_ Write a program to convert a decimal number into binary number, (6)
5. a) Cana fanetion retum an array to the calling function? Explain with example. [4]
b) Write a program to read a mxn matrix of integers and to find the largest elements of
each row. Store the largest elements of the row in a one-dimensional array of m
integers before displaying them. [6]
6. a) How does a structure differ from an array? What are the different ways to access
structure member? [4]
b) Create a structure named student that has name, roll and marks as members. Assume
appropriate types and size of members. Use this structure to read and display records
of 10 students. Crete two functions: One is to read information of students and other
to display the information, {6
7. a) Define following term is}
) int*p:
ii) int p(char*a)
iii) int(*p(char*a))
iv) int *p(void)
v) int*(*p[LO] char a)
b) Write the advantages of using pointer in C- programming. 3}
8, Write a program to copy to copy content of one file souree.txt to another
destinotion.xt. 8]
9. a) Explain the FORTRAN structure. What are different types on FORTAN? [213]os TRIBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING
Candidates are required to give their answers in their own words as far as practicable.
Attempt AU questions.
The figures in the margin indicate Full Marks,
Assume suitable data if necessary.
a) What do you mean by Programming Language? Explain about the evolution of
programming languages. (143)
b) What are the advantages of a Flowchart design? Write down the guidelines to be
followed to draw a flowchart. b+]
a) What is the purpose of the semicolon that appears at the end of most assignment
statement in C? Explain the program compilation, linking and Joading process with
example. 2+]
b) Discuss the types of errors in programming. How do you debug a C-program? +4]
a) Explain relational and logical operators. (4)
b) Write a C program to display following pattern without using formatted inpuvoutput
statements. 4
Programming
rogrammin
ogrammi
gramm
ram
a
a) Why do we need control statements? Compare switch and ifelse-if ladder with
example, (4)
b) Write a C program to display all characters between a given ranges. (6)
8) What are the advantages of using functions? Differentiate between Library functions
and User-defined functions with suitable example. (31
b) Write a program to check whether @ given number is Armstrong number or not using
recursive function. 15]
a) Write a C program to read two strings in main and compare them using userdefined
function, Display appropriate message from main. [4]
'b) What are overflow and underflow errors in context of array? Write a program to add
corresponding elements of two arrays, The results should form a new array 244]
2) Why should we prefer structure over array? Explain nested structure with example, [24]
b) Write a program to read name and roll number of-48 students from user and store
them in file, If the file already contains data, your program should add new data at the
end of the file. (6)
a) What is the structure of FORTRAN program? (5)
b) Write a FORTRAN program to read n numbers and display largest number among
them. 6)2 TRIBHUVAN UNIVERSITY (Exam.
INSTITUTE OF ENGINEERING [Level
Candidates are required to give their answers in their own words as far as practicable
Attempt All questions.
The figures in the margin indicate Full Marks.
Assume suitable data if necessary.
KMAK
1. Explain the generations of programming language. Distinguish between High level and
Low level programming language. (3+3]
2, What is an algorithm and how it diflers from pseudo-code? Develop algorithm and draw
flowchart to find the largest of N numbers. [24343]
3. a) What are identifiers? List the rules to define valid C identifiers. (23)
b) What is operator? Describe the conditional operator in C with syntax and example, [2+3]
4, What are the differences between global and local function, variables and data types, &
(Ampersand) operator and * operators used in ¢-programming language? Explain with
example. [4+4]
5. a) Differentiate between pass by value and pass by reference. BI
b) Explain the significance of user defined functions with example. [5]
6. a) Write a program to read a string and check whether it consists of Alphabet or not. Use
user defined function to accomplish the task. (1
b) Explain how 2D array is passed to a function. Write a C program to display largest
and smallest elements of @ 2D array. (3)
7. What is nested structure? Write a program in C to read name, age and salary of 10
different employees as the three members of a structure named as “employee”. Sort this
data in salary basis using user defined function and display sorted data from main
funetion. [248]
8. Write a program in C-programming language to compute the cosine series. (hints:
cos(x) = 1-x?/2!-+x4/41-x°/6!+. up to n terms) (9)
9, Write a program to open file named INVENTORY and store in it for maximum 10000
data of ITEM_NAME, NUMBER, PRICE, QUANTITY. Extend the program to read this
data from the above given filename and display the inventory table with the value of each
item. [6]
10.2) Compare unconditional goto and computed goto in FORTRAN with syntax, BI
b) Write a program in FORTRAN to read an array containing N elements, sort this data
in ascending order and display the result.
one
{5}3 TRIBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING _ Full Marks | 80
Examination Control Division | Programme
18>9]. [24244]
a) Write a program to read a string.and rewrite its characters in alphabetical order. [4]
b) A multinational company has hired 3 sales persons for marketing/selling its 3
different products in Kathmandu, Each sales person sells cach of these products.
Write a program to read number of each product sold by all-sales-persons. Calculate
total sells-of each item and the total sells of each sales-person. Use arrays {6
a) Explain about “Arrays within structures” along with programming example: 4]
b) Write the program “to understand how structure members are sent to a function”, (4)
Write down advantages of pointer. Write a program using pointer to swap the value of
two variables where the swapping operation is performed in separate function. (2+6)
_Sort them in ascending order of salary and store the sorted record 16 a binary file. Display *
“the details and rank af employee given by the user. 8]
8) What do yourwiéan by formatted sind unformatted inpuvoutput statements i Foran
and also give suitable example which explain the concept of Formatted UO: rea}
(>) Write the program to convert a binary nufaber to a decimal number using Fortran
programming language. 4v
v
v
¥
INSTITUTE OF ENGINEERING Level — Full Marks | 80
amination Control Division | Programme | All (Fxcept B. Arch) Pass Marks | 32
2071 Chaitra (Near /Part (1/1 Time [3h
05 __TRIBHUVAN UNIVERSITY [tea Peis Regulars Sl
__ Subject: - Computer Pro
gramming (C7401)
Candidates are required to give their answers in their own words as far as practicable.
Attempt All questions.
The figures in the margin indicate Full Marks.
Assume suitable data if necessary.
2) What is mean by compilation? What is mean by interpretation? How do these two
processes differ? (4
b) Define programming language? What are the features of good computer program? [+3]
a) What are preprocessor directives? Explain constants and variables. (242)
b). Write syntax and example of following statements/fumetions: [x4]
i) printf
ii) getch
iii) seanf
iy) tong
What are control statements? Illustrate nested IF statement with its flowebart. Write a
program to caleulate the series: 1x10+3%20+6%30+ AAD 0M, where N is
an integer term read from the keyboard. [24246]
a) Write a program to display Armstrong numbers between the range entered by a user
and also display their counts, You must use a function to check for Armstrong
numbers and display them from main. 14]
b) What do you mean by nested function and recursive function? Give an example of
recursive function. [242]
a) Write a © program to read a string and display its reverse. Use user defined function
to count number of characters in it and to reverse io
b) Write an algorithm to insert a value‘in an array at a position given by user (4
2) What is a tag? Must a tag be included in a structure type definition? Must a tag be
included in a structure variable declaration? Explain 3 [e142]
b) Write a C program that reads several different name3 and address using structure
computer, rearrange the names into alphabetical order and write out alphabetical list. (4)
Tiustrate with example that "Array is indirectly a pointer’. Write program -to calculate
sum and average of integer numbers heisween M and N (where value of M and N are read
from keyboard) using pointer. [4+],
Write a program to continuously read name, age and salary of a worker and write it into a
file until user confirms to end, Then read n from user and display the n® record in the file.
Details of worker must be represented by a structure. a
1a) Compare arithmetic and logical if statements in FORTRAN, a
_b) Write a FORTRAN program to display nature of roots of @ quadratic equation.
Calculate and display the roots, if they are real and equal (8)~ Full Marks | §0
05 TRIBHUVAN University ; BH
INSTITUTE OF ENGINEERING Level BE
Examination Control Division | programme | A! (F*°P pass Macks 32
2070 Ashad VYear/ Part Time Shs,
Subject: ~ Computer Programming (CT40/)
Candidates are required to give their answers in their own words as far as p
Attempt AML questions,
The figures in the margin indicate Full Marks
Assume suttable data if necessary,
2) Define software. Explain its types. B]
b) What are the steps required to develop a computer program? Explain. 6)
a) What are relational operators and assignment operators? Explain with examples. BI
b) Rewrite the following program by correcting any syntactical errors, if present, Also
show the output of the corrected code. BH)
Hinclude
int main ()
{
float root, int i= 15
do{ sum=2i-4,
int (e%eln”, sun),
51;
} while (surm'<= 15)
root = pow (i, 1/2);
print (\n%.3P", root)
return void;
,
a) Write a program to read the number until - 1 is encountered. Also count the number of
even number and odd numbers entered by the user (6
b)_ Distinguish between break and continue statement with example [4]
a) Explain how function is defined in C? Differentiate call by value and call by
reference. {2}
= b) Write a program using a function that returns the largest aumber from an anay of
numbers that is passed to the function, (5
a) How are one dimensional and two dimensional arrays created in C? Explain with
examples. [242]
}) Write aC program to read two matrices from user, aid them and display the result in
matrix form (6)
What do you mean by nested structures? Give suitable example. Write a program to read
the heights of two students and display the difference between their heights, Use feet and
inches as members of a structure to, define height 6]
a) ‘Compare array and poimter with example 1)
b). Write a program to read a string fiom user and use a user defined function to copy the
content of the read string into another character wrray changing lower case letier to
upper if any. Use pointer to process the string (3}
Write a program to read the details of book authors and write it t6 a file, until the user
confirms to cod. Then cead-and display the n"™ ree the Tile, where nis read from
user. The data for authors must be represented hy structures that contain name, national
and number of books published. (8)
din the FORTRAN strugture. What are data types in FORTRAN, ne. 242]ee ;
03 mummuvan unveRsTry a .
INSTITUTE OF ENGINEERING — | BE.
Examination Control Division | Programme! at cen 8-400)
2070 Chaitra YeariP:
Programming (C1407),
‘Candidates are required to
e their answers intheir own words as far as practicable,
“Attempt All guestions
v
The figures in the margin indicie Full Marks, a {
Assume suitable data if necessary.
a) What do you mean by software and explain about generation of programening,
Tanguages. 4)
') Define the term "Flowehait”. Discuss about different symbols used in Flowchart, fa] 7 |
. Ay Find out final value of a, b and c where following expressions arc executed
sequentially, -
inta=2,-3,¢; .
a= (bHt) + (4b) +
>b 7 ab; |
be (at) +0) +45 i
omer
©) What are the difference between formatted ad unformatted VO statements? Deseri
‘with proper example. ' (>
3. 9). Explain-importarice of break snd default statements in switeh statements : 8
5) Write aC program to display following pattem using unformatted output stateménts: {7} ©
P
Pu
ee
PURE.
Puke
PULCHO : Sis |
puleHow
PULCHOWK
‘Define “funtion definition” and virite the program to find the sum of two numbers
Using uscrdetined functions, 1
}) What do you mean: by “call by value and cal! by reference” slong with suitable
example? wy t
Can we pass whole array clement from function? Write a program to display only those t
students information which are passed. Use separate function t0 check the result of
Student, ‘The information of shidents like Name, Roll No, Adress a Marks are passed
‘Trom main functions and pass to functions using array type argument. (248)ay
ra)
»
Explain the use of typedef of heyonrd in stuctures
eplain the néed of nested structure. Write 8 © promyam 1 $21
in AD using stracture. Use the data
“A poloter vafable is used ta sore address af sorte oth variables; how
to specify datatype while declaring
Biefly'explain array of pointers. He
matrices
Defize opening and eldsng a file covg wth suitable examples
‘Wve the: pogram to display the cords in soned order Sorting COME
ascending ender with respect name using data ies Concept
Compe ainsi are loyal if saterentsin FORTRAN with subi exemple:
Weite'a FORTRAN program to rend 1"
ifference of cutent data.
' pointer variable. Why?
ie
sn
ws
relent fy
(8),
aie aay ndpoiner rece? Give evi. |)
(ah
|
ia
mate, transpose it snd dspldy bath the05 © TRIBHUVAN UNIVERSITY (fam.
INSTITUTE OF ENGINEERING = oo BE
Examination Control Division | Programme Allis
2069 Ashad [Year /Part (1/1
Candidates are required to give their answers in their own words as far as practicable,
¥
¥ Attempt AN questions.
The figures in the margin indicate Full Marks
Y Assume suitable data if necessary.
1. Differentiate between high level and low level. Explain the steps of solving a problem
using computer. [44]
2. Consider a statement
scané (“8s", str) i
Where stris a string variable
In above statement, why “&" symbol is not used? Can we input string with space in this
statement? If not, why? "1
3. Write a program in C to find all possible roots ofa quadratic equation ax*+bx+eu0. 8)
Writs down significance of main( ) function in C. Differentiate between pass by value
‘and pass by reference arguments. Describe both with meaningful example, (246)
5, Explain how array can be passed to funetions. Write a program that passes an array to @
function and print the largest and smellest element. B+)
6. How are structures different from arrays? Create a structure in C to store the name of
Fratsman, runs scored and no of times the batsman in dismissed. In the program, read the
data of five players and display the batting average of the player whose name is entered
by the user. Batting average is given by total.runs/total dismissals, 6)
7. Write down advantages of pointer. What type of arithmetic operations can be
implemented in pointer? Also describe the relationship between array and pointer with
appropriate syntax and examples. [21393]
8. Write a program in C, to read the following information for 96 students.
Student Name, Student roll number, Marks cbtained(in 100)
Record all data in “oestxt” file, and program should print roll number und name of
student who have obtained greater than or equal to 40 marks. (8)
Revmtite the following source code comecting any error present in if, Also indicate the
error corrected in comment. Then write the output of the program. (a+)(/progran to convert List of tesperatures
//3a Centigrade to Fahrenheit
include steio.hs
int main)
f
int 4, nea
float’ colcin), farentnt;
for|ie0; tens i++)
‘
print ("Celctsal—n)
scant ("td", cele(il)r
1
convert (cele, Faren, n); b
for (10; icnr 444) print (Zacentt));
te
Void convertifloat cel{}, float fart}, int a)
4
for(iOs Sens it) celzfartfarfil, cel{iiy
”
cel2far(float £, float ¢)
(fe o/sectsz; 1s
10. How are do-loops used in FORTRAN? Explain with example. Compare it with implied
do-loop. Write a FORTRAN program to read ten integer numbers, store them in array,
arrange them in ascending order and display the sorted list
11. What is the syntax of two dimensional arrays in FORTRAN? Explain with example,
[14146]
(405. TRIBHUVAN UNIversiTy Gas.
INSTITUTE OF ENGINEERING Level BE Full Marks
Examination Control Division programme UE se saunas
2069 Chaitra Year /Part 1s ime
Subject: - Computer Programming | (CP401)
Y. Candidates are required to give their answers
Alterpt AUl questions
The figuies in the margin indicate Full
Assume suitable data if necessary.
ir own words as far as practicable
v
v
v
1) a) Write down the difference between Com;
piler and interpreter. Explain the role of
linker.
») Explain the importance of flowchart. Also draw a flowchart to find reverse of an
integer qumber. For example, 12345 is an integer number and its reverse is $432),
2) a) Why do we include in
using any header file?
b) Give the output of t
our program? Can we write a C program without
following program and justify your answer with reason
Hincludessidio h>
int maint)
Bx (y 3/2244 ty;
printf(“a=%d".a),
+ printhb=%a"b);
retum 0
80
(242)
(143)
(+1)
6)€) Weite a program that prints the floating point value with following specification. (2
i) Correct up to wo decimal places
di) Correct up to four decimal places
5) ) Wete «program to read the number watil-1 is eneountered, Afso count ihe number of
prime number and composite numbers enered by the user (6)
b) Explain why goto statement should be avoided? Distinguish Perwecn break and
continue statement with example source code {143}
4) a) Wrife a program to caleulate the exptx.y) using recuraye fonction without using
owt) tunetion. [Example: exp(2,3)=2°3 ie. 2°2*2-8] iO}
») Differentiate between eall by reference anc gall by value with example. (4
5) Explain ay canbe passed to 2 function. Write a program t0 transpose @ 393
matrix, Two matrix are input from the main () function and pass t0 a Usk defined
Trctign with argument as array. The result is displayed from the main function. (246)
6) What is advantage of using structure? Create an array of struchire DANE Employee with
name and salary as structure member and the array of structure is passed to a function
which sorts in ascending, order on the basis of salary and display the sorted array from
main). (2+)
7) 8) Compare array and pointer with example By
b) (Write a program reads string from user dnd use a user defined function to copy the
aoa ce vent of the read string into another character array changing lower case letter to upper
iffany, Use pointer 1 process the string 15]
8) a) Differentiate between text file and binary file Ql
b) Write a program, taking care of all the possible error condition that may occur, to open
‘anew file name DATA that reads integers from user tntl user Says “no” .Afier reading,
the data write all the odd numbers to a file called ODD and all the even number to file
called EVEN 8
6) Explain the FORTRAN structure. what are datatypes in Fortran 2 @&
10} Write a program in FORTRAN to solve quadratic equation and display roots in proper
format 7 18]06 TRI
Examination Control Division | progamme XE" pass stark
‘
¥
7
SVAN eavERSITY [Bian "7" New ack Gee Bach &
INSTITUTE OF ENGINEERING [Level (BE Pull Marks
B.Awh.)
r
2068 Shrawan Time
Candidates are required to give their answers in their own words as far as practicable,
Aicempt Alt questions:
The figures in the margin indicate Full Marks,
Aszune cuitable data ifnecessary
Define algorithm. Write an algorithm for finding largest and smallest values from alist. [246]
Draw a flowchart and algorithm to find roots of a quadratic equation (ax? + bx + ¢ = 0)
Include all three conditions of the determinant {19}
[8]
tions. [3123]
‘functions in program? Differentiate actual and formal parameters used in fe
Write a program to take a list of values from user into an array. Pass the list to a function
‘which sorts the values in ascending order. Display the sorted list from main program, [345]
Write a prog
ram tO represent complex number by a str
members, Take 2 complex numbers as input from-yscr
complex numbers to a function which calculates sum an
feture with real and inaginary as
nto structure variables, Pass the
Display the sum. from
another flinetion display() 110}
What is the role of pointers in passing parameters to functions by refarence? Give
example, how 2 dimensional array can be accessed by a pointer, [a4]
What do you mean by opening a data file? How is this accomplished? Explaia fecanf,
fprinté, fread, fwrite functions. [+3
Explain the structure of a FORTAN program, Differentiate between arithmetic and
logical if statement, Re]
Write a program in FORTAN to read two matrices ftom user, find their sum and display
the sum. if0s RYAN UNIVERSITY Ean
INSTITUTE OF ENGINEERING (Eaves
Examination Control Division Programme
2068 Chaitra
VAI (Excapt B,
Arch.)
_ Subject: ~ Computer Programming (CT 401)
¥ Candidates are required to give their answers in their own words as far as practicable.
¥ Auempi All questions,
Y. The figures in the margin indicate Full Marks
¥ Assume suitable data ifnecessary.
1. a) How high level programming languages are similar to natural language? Describe. by}
b) Does Algorithm and Flovichat design makes programiming fastér aid eaziér?
Describe with strong supporting points. Also draw flowchatt to check whether a
number is Armstrong or not, [2437
2. a) What are unary operators in C? Why are they named so? 2)
©) What are preprocessor directives in C? Why are they needed? 21
©} How formaited input/output canbe performed in C? Explin with example. il
3.. Differentiate between, conditional operator and if-else statement, Write a program ‘in C
thas calcultes the suri of digits entered by the user successively until the sein seduces 16.
a single digit number. For example, 12345 => 1+243+445=15-51 + y 246)
‘Write a program in C to read'a string and-display it in reverse order. Use uset’ defini
funétions to count the mumber of charactors in it and reverse i [8],
5. Write down the significance of array in C. Write a program to multiply tWo 3x3 matrix.
‘Two matrix are input from main () fimetion and pass to a user defined finction with
argument with array. The result is also displayed from main () function, [246]
&. My structure variable differs ftom array? Write’a progrim to input name, post and salary
of ten employees from main (.) function and pass to structure type user defiried function
Grguments of this function should also a structure type). This Ainction retuns suche
‘variable which Keeps the record of only those. employees whiose salary is greater than
10,000. This modified record is also displayed from main () function, (246)
7. Explain how pointers can be used in C. How can you access ariay elemints using pointer.
Wate 2 C program that reeds a string from user and use a user defined function to copy
the contents of the read string into another character array changing lower case letters to
upper if any, Use pointer to process string [1+1+6)
8, Write a program to input and save record like name, roll, address aid obiained raark of 48
students in a binary file and search and display the record of.a student whose obtained
‘inark in highest. The information should be organized in a stnicture, i [8}
9. Write.a. program in. FORTAN, to check whether a positive integer eniered from the
Keyboard is a palindrome of hot, (Hints: A number is palindrome if its reverse is equal. -
thenumberitsel).9 9... s SSE STB
10. Write FORTRAN program to display greatest and smallest number form list ten elements, {8}
ree ie05 Fam
INSTITUTE CF ENGINEERING Level
Pxamination Controi Division
Programme
2067 Ashatn > Year | Pi
Subject. Compass Fe
Candidstes are required 10
Attempt AU questioxs.
¥ ‘The figures in the mar
¥ Assume suitable dova i
ir answers in their own words as far as practicable
indicace Pull Marks,
necessary
~
What is high level tang
‘computer program
lage? What are the di
language C is different fi
nl types of high level languages? How
ma FORTRAN? [1+3+4] we
Write an algorithm and flowchart of the ¢
govemed by formula D? = (x, — x;
‘but should not be zero,
ice between two points (4, y:) and (x, ¥2),
(a — ya)", Where, xi, Xa Vis Yo ate given by user,
G5]
3. Write a syntax used in C programming language for the fallowings 2x3]
8) sean) b) while ©) struct ye
® ifelse ©) static
4 What are the significant meanings of '&* and ‘*” established in € programming? How
Creceratiretist between ‘called by valus’ and ‘called by reference” with example a
C prosramaning? y fae}
% State with example, how switch ( ) fiction differs ftom user defined funeton in
computer programing language C. i
ZA wie 4 pseudocode to, fad the standard deviation of an anay of values in C
programming, The array elements are read fiom the temminal. Use user defined functions
ry (‘o caleulats standard deviation and mean. Standard deviation of n value is given by (8
[Sen “x
sp=ye \
Vere Xq is the mean of the values.
1 © aocording to the output displayed below: (to
named RECORD.te f nimnber of data where Cast, Service Charge 5%,
5 and Tolal Cost misTbe calduated by frogram ici) om 0)
Outputs 4
[ten Code] Dessiptan = Quantity oat
oor Computer 22,000.00 3 | 110,000.00
[oom Cel Phone 8,000.00 10 80,000.00
VAT 15% -
Service Charge 531” a aI
Total Cost = 1
E 7 ‘Fhamk You!!! Visit Againand write cuspst of th program writen in C
# incndea
# includesconi
(
char arl (1B) = (1 f0'"E', 1, P SEO WICH NG 7
char ar2[15] =“loF, Pulchowt";
char ar3[11]= (£1), 60°) os
CACPRCULCLL CO) CE} COLOW LORE
‘tscsr( J; ‘
printf CinArray 1 =%e\", ar;
printf (\mArray 2 = %gin”, ar2);
printf (Array | = ein”, ar)
-return4)
)
9. Describe the formatted input aud output statement in FORTRAN programming language
with it’s syntax.
(4)
10. Write a program in FORTRAN to evaluate the following series: a
series = V1 M2 VBE a a EaIVAN UNIVERSITY
INSTITUTE OF ENGINEERING
¥ are required to give their answers in ¢ able.
¥ Atcempt All questions
Y. The figures in the margin indicate F
¥ Assure suitable data if nece
1, Differentiate interpreter and compiler. Briefly followed for developing
a2,
Woaat isa data ty
associativity
2 Explain the ope
3 available ja
ng with their pr:
“You are given a task to develop.a system to read at least 50 integer numbers and
continue until the user enteis NO. Your system must haye
and average of those numbers which are exactly divisible by 9 but not by 6 aiid Hes in
between | to 100 and display a suitable message-if no suth number ts fead”. Writ
algorithm and flowchart to develop stich System.
How recursion is digferent from iteration? Write’ code in.C to icsteulate
following setiss ub to n terms specified by the user Where a is passed to the functisn that
ealeulates the sum. Your program should have more than wo functions, un
(2°35) + (495!7) + (6*7/9) 4... i
Describe the limitstions of using getchar and scanf fictions for reading strings. Write a
complete program to insert a into another string in the location specified by the
user, Reed the string in main fiction, pass them to another function along with inserting
position and returns the resulting string [248]
6. Explain the relation of array end pointer. What is meant by call by value and call by
reference? Write a complete program that adds the corresponding element
e
matrices if the elements.are positive, otheny}
the- concept of passing arrily tothe Function:
7. Define the stru ing? Explain nested structure with suitable exemple
Write a pro: passing the structure to the fi th
convert the date (in format Y Y/MMABDD) in B.S. to A.D.
plain the VO operations on file with suitable example and also
situations during YO operations in file. Hol
accessed?
tion
result
ate the typical exror
he contents in the file can be randomiy
(6-4)
iat_ace FORTAN’s constants, variableitnd’ brary ‘functions? Explain. Write 2
“program _in EORTAN tn-take-a position and 2-qumber and insert-this mtaberom-tiis
position faside an array containing n elements,