Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Programming fundamentals exam practice questions

Rating
-
Sold
-
Pages
3
Grade
B
Uploaded on
25-03-2024
Written in
2013/2014

Programming fundamentals exam practice questions

Institution
Course

Content preview

Intro to Computing
Final, Summer 2014
Date: 4thAugust, 2014 Marks: 75 Time: 180 minutes.




1. [15 marks]
Write a function getplural that receives a noun from main and convert into plurals on the basis
of these rules:
a. If noun ends in” y„ remove” y„ and add „ies.„
b. If noun ends in „s„, ” ch„, or ” sh„ and ” es.„
c. In all other case, just add ” s.„
The main will call the function and will display the plural of the noun.
Output:
Enter a noun: student
The plural of student is students
Note:
1. Built in strings and string functions are not allowed.
2. The size of the string will be such that nouns of maximum length can be input.
2. [15 marks]
An image can be represented by a 2D array of integers, where each integer represents the
colour of a particular row and column in that image. One way to blur an image is that for each
element at a particular row or column, we calculate the average of all its neighbours (including
itself), and then replace the original value with this average. For example, in the image below, 2
should be replaced by the average of 2,2,3,4,2,4,8,8, and 9 i.e. 5. The number of neighbours are
clear from example given below.

2 2 3 1 2 3
4 2 4 4 5 6
8 8 9 7 8 9

Write a program which blurs an image. The main creates a 2D integer array. Your program
should be changeable for image resolution (number of rows and columns) i.e. generic program.
Then the user should be asked to enter the image data from the console as well. After that, it
should call a function called blur which takes the image as input and returns a blurred image.
3. [15 marks]
Write a program (main) in C++ to count and display the number of lines not starting with string
“The” present in a text file "STORY.TXT".
Example:
If the file "STORY.TXT" contains the following lines,
The rose is red.
A girl is playing there.
There is a playground.
An aeroplane is in the sky.
Numbers are not allowed in the password.

Department of Computer Science
National University of Computer & Emerging Sciences, Lahore Page 1 of 3

Written for

Course

Document information

Uploaded on
March 25, 2024
Number of pages
3
Written in
2013/2014
Type
Exam (elaborations)
Contains
Only questions

Subjects

$8.89
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
MissGhani

Get to know the seller

Seller avatar
MissGhani Exam Questions
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
5 year
Number of followers
0
Documents
4
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions