0 ratings0% found this document useful (0 votes) 19 views4 pagesExam Paper C++
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
1
6.
ha mes ran reg wedece Comp
Attempt alt the questions
a)
by
)
by
a)
b)
a)
b)
a)
b)
a)
~b)
y
b)
a)
b)
a)
b)
°)
d) Define the ro
e) What is funct
f
Write short answers on any five:
Year/Part
‘hat do.
you mean by » .
Programming languages ong language? Explain on different generations of
tite an alporithe ee
ithm an
ag d draw a flowchart to check the given number is Prime or 7
What is a vari
able?
Programming, Explain the necessary rules to define the variables name in C
at do you me;
i an
in C pro, an by an operator? List down the different types of operators used 9
Programming, Writ
days ina year.” Write @ C program to display number of weeks and remaining
What is structure?
structure?
What is bray
nchi i
een, ing statement? Write a C program to find a factorial of the given
What is i
tnatrie, an array? Write a programme to find the sum of diagonal elements of 3*3
What is an a ,
* po an access specifier? Explain about different types of access specifiers used
What is a pointer? Explain pointer with pointer arithmetic
Explain how a function is defined in C. Write a program to find the sum of two
numbers using function with argument and return type.
OR
‘What is a function? Discuss it in terms of arguments and retum value.
How can a function return multiple values? Explain with example.
What is an object-oriented programming? How is it different from
procedure-oriented programming? Explain.
‘What is friend function? How a function can be friendly to a class? Explain it with
suitable example.
Ok : a n
Define constructor. Describe all types of constructors used in C++ with suitable
Explain its components. How can you access the members of a
example. ; _
What does Inheritance mean in C++? Explain with its type.
What are global and local variables?
What do you mean by class in C++?
Why exception handling is used in Cr+"
Ie of template function.
ion overriding?
Find out the output:
void main()
{int X,Y;
5x2on Discuss the concept of pointers in C. Whats pointer arithmetic and howiisit 8
used? Write a C program to swap the on of two variables using pointers.
suss the dynamic memory allocation Concept in €, Write a program to
locate memary dynamically for an inter and a character variable and input
the data for each and display them. — :
6.a) Define a structure and a union in C. Whatis a self-referential structure? Write a 7
program to show an example of nested structure.
6.b) Write a C program that creates a file named "data.txt", opens the file in write 8
A mode, and prompts the user to enter the name and salary of 10 people. The
program should then write these values in file. Finally, the program should
close the file and print a message indicating that the file has been created and
the data has been written to it.
gw Write short notes on any two: 5*2=10
Software and its types
’b. Recursive function
_& Operators in C
@. Functions related to strings
tr inclode datdionh’s
doer 0)
wt ot) $205
print Ci Ever fre. elerrer”S
for C1201 1<3 Bien)
Seah for fj jearjt?> bie ,
fe cd ap i
, 0
i
Atte 2 ba)POKHARA UNIVERSITY
ive their answers in their own words as far
e margin indicate full marks,
Attempt all the questions.
L x What is software? Explain various types of software in brief, =
by’ Write an algorithm and draw a flowchart to check whether a number
given by the us le by 2 and 3.
2. gf Why the C language is called a middle-te el language? What are the
benefits of C being a le in Detail.
by, What are the different branching statements in C? Create a ment-
driven program having the fllowing options:
‘Sum of three numbers. |=
3. _a)/ How does a for-ioop work? Explain in brief. Also
| print the following series up to four terms: 1,4, 9, 16,
Why do you need arrays? Write a program to read a matrix of onder
_ Pte and ro its renspose mati
4. af What are the advantages of using a function? Write a program to find
ite a program to
argument and returns the area to the calling function.
‘What are pointer variables? Write a program to find the sum of
elements of an integer array using pointer (not the index of the array).
OR
Explain about the different types of dynamic memory_allocation
techniques used in C.
5. a) Define a recursive function. “Write a program to find the sum of
numbers from 1 to 50 using recursiye function.
6
L
OR
Write a program to check whether the number is prime or not using
user defined function,
‘What are character arrays in C? Write a program to print the following 7
patt
ENGINEER
ENGINEE
ENGINE,
ENGIN
ENGI
ENG
EN
E
a) Create a nested structure for the following data. 8
Emp_id | Emp_name | Department | Address | Date of birth \
mm | dd | yyyy |
i 10 employees and display the
deals of employ oi
b) What are the different file opening modes? Write a program to read
name and marks of n number of students and store them in a file.
‘Write short notes on: (Any two)
) Formatted input/output functions
b) Storage classes
©) Union
7
2x5Level: Bachelor
Prograi
Subject:
1p
Pokhara University
Interna Assessment
Semester: Spring, ta
B.E. Computer Full Marks: 100
Programming in C Pass Marks: 45
Time: 3 hrs.
Candidates are required to give their answers in their own words as far as practicable, The
Jigures in the margin indicate full marks. Attempt all questions.
¥4) Discuss the generations of programming languages. Explain the characteristics 8
Ae
ot
ae
of the high-level programming langujge with suitable examples
Describe the stages of problem solving using a computer. Explain each stage in 7
detail with the help of an example.
OR
‘What is structured programming and write the importance of structured
programming.
Discuss the history of the C language and its features. What makes C a middle- 8
evel language and a system programming language? Give examples.
4 BP Write aC program to demonstrate theuse ofall the datatypes in ©, including 7
g ee SaaS =
e
rs)
i ~-the,character-nad-the-date-typ:
Explain control strucjures. Write a C program to find 20 items ina Fibonacci. 7
series. =
Discuss the concept of arrays in C, including the initialization and accessing of 8
array elements. Write a program to sort an array of integers in ascending order
OR
éplain the concept of strings in C as character arrays. Write a program to
“Calculate the sum of three 3x3 matrices,
=
Agi Deserbe the importance of fantionsin € programming. Explain how to return 8
4.b)
avalue from a function and how to pass a value to a function. Write aC
program to calculate the area of a circle using a function. grt —>—
Explain how to return multiple values from a function and how to pass by
reference to a function. Write a C program to calculate the sum and product of
two values using only one function(pass by reference).
Explain the concept-oF storage glasses jy, the C programming language. Give 7
examples of each type of storilge class, nd describe their respective scope,
lifetime, and initialization rules.
ee