Home /University of Sarghoda /Computer Science

Computer Science ADP 2 Semester/Term University of Sarghoda 2022

Computer Science ADP 2 Semester/Term University of Sarghoda 2022 — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

Need Paper? See all →

Need a paper or stuck on a question? Ask here — students reply and you get an email.

Ask about a paper
  • Bushra· 21 hours ago

    BS Islamic Studies, 5th semester, ISL-511 Translation of Holy Quran (3) — Government College University Faisalabad (GCU…

    0 replies Reply →
  • Khadija· 2 days ago

    Civics course code GCCE101

    1 reply Reply →
  • Tasddaq hussain· 2 days ago

    BS 4the semester2025 civics and community engagement past paper According UOs

    0 replies Reply →
  • Humna Khan· 3 days ago

    Bs public administration 1st semester mid term past papers

    0 replies Reply →
  • Rania· 3 days ago

    BS English from uni of Sargodha Functional English, history of old English literature, literary devices and genres,

    0 replies Reply →
Ad

Paper text

University of Sargodha

ADP 2nd Semester Examination 2022

Subject: Computer Science

Time Allowed: 2:30 Hours

Maximum Marks: 60

Note: Attempt any three questions from subjective part.

Objective Part (20 Marks)

Q.1. Write short answers of the following in 2-3 lines each. (20 Marks)

a. Differentiate between algorithm flow chart and pseudo code.

b. Define variable and give its example.

c. Define algorithm.

d. List the basic elements of a computer program.

e. Explain the difference between C and C++ with example.

f. Define input and output operations with some examples.

g. Differentiate between variable and constant with examples.

h. Explain the basic structure of a C++ program.

i. What does header section do in a C++ program?

j. What does main function do in a C++ program?

k. What are the different types of data types used in C++?

l. What are the different types of operators used in C++ with example?

m. What is variable in C++? Explain it with example.

n. What is constant in C++? Give its example.

o. How do you declare and initialize a variable in C++?

p. What do you know about coding and debugging?

Subjective Part (40 Marks)

Q.2. Write a notes on the following: Define variable, list its types and explain its usage with examples of each in C++ language.

(Marks: 13.33)

Q.3. Given an array of positive integers, we need to find the number of times each one occurs, called as the frequency of items. Find by writing a C++ code to calculate given. For example: Input array is = {2, 3, 5, 2, 1, 3} then output should be 1:1, 2:2, 3:2, 5:1.

Q.4. Write a program to print the 1 to 10000 in the array, the array is a matrix of 100 rows and 100 columns, all the elements of the array code, and the program should be in C++ language. For example, in the array {10, 4, 3, 5, 12...} should be 17, 7 and

5.

Q.5. Write a C++ code another C++ code in the following sequence calculate the result, output: 1, 2, 3, 4 and the C++ code will be the sequence of them.

Q.6. Write a Program for area of a triangle. The triangle figure would be a = 3, b = 5, c =

4. Then output should be area of triangle is 17.3205. Area of triangle can easily be calculated using formula as here: https://www.google.com where a, b, c are the lengths of sides of triangle and s = (a+b+c)/2.