Vous êtes sur la page 1sur 4

MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY, JAMSHORO.

DEPARTMENT OF BASIC SCIENCES & RELATED STUDIES Subject: Introduction to Computers and C + + Programming Batch: 04-CE Max. Marks: 80 Date: Time allowed: 3 hours NOTE: Attempt any FIVE questions. All questions carry equal marks. Question # 8 is compulsory. Q#1. What is the basic structure of a C ++ program? Explain each statement. Define different data types defined in C ++. If two bodies of masses m 1 and m 2 attached at two ends of a string are moving over a pully. Write a program to find the ( m1 m2 ) ( m1 m2 ) tension in the string defined by when the values of masses

are entered by the user from keyboard. Q#2. How a program code is repeated in C ++ ? Explain each repetitive structure with its syntax and flow chart. Write a program to count the characters and words in a phrase you typed. (a) (b) Q#4. Explain if and if else statements. Write a C ++ program to form a four function calculator using switch statement. Define an array. How an array can be declared and initialized? Write a program to find the maximum number from a one dimensional array. Discuss the advantage of functioning. What are predefined and user defined functions? What is Function Overloading, Recursion and Function Templates? Write a program to demonstrate the function overloading. (a) (b) Q#6 (a) (b) Q#7 Explain the idea of structures in C ++? What is a structure tag? Give the syntax of structure. Write a program code to explain the structure. Define Strings and String Handling Functions. Write a program to demonstrate the string handling functions. What is graphics? Write a program to print your message on the screen in a circle with different colors. Write a program to display the nested ellipse in different colors on the screen. Explain the following with examples. 1. 2. 3. 4. Five Generations of Computers Types of Computers according to their Function, Size and Purpose. Data Processing, its types and Data Processing Cycle Desk Top, Icons, task Bar, Start Button, My Computer, Recycle Bin.

Q#3.

Q#5.

Q#8.

(a)

Find the error if any and correct.

i.
ii.

area = 3.141 * r * * 2 ; if ( a < 7 ) ; cout >> a is less than 7 . void main ( ) { int i = - 4; j ; num = 3 ; j = ( i < 0 ? 0 : num * num ); cout<< j ; }

iii.

(b)

What will be the output of the following

i.

int x; cout<< The size of int x is < < sizeof ( x ) << bytes. ; void main ( ) { int x = 3, y , z ; y = x = 10; z = x < 10 ; cout< < x = <<x<<y = <<y<< z = <<z; } int i = 8, j = 5; float z; z = 2 * ( ( i / 5 ) + ( 4 * ( j 3 ))) % ( i + j 2 );

ii.

iii.

(c)

Write in C ++ statement. b ( a*b ) 2 4 ab i. a 2 b 2

ii.

R 2 sin xabs log (y x x

y2 )

THE END

Mehran University of Engineering and Technology, Jamshoro Department of Basic Sciences and Related Studies

Subject: Dated:

Introduction to Computer and C++ Programming


Regular Practical Examination 2004 Discipline Civil Batch 04

First Year First Term

Time allowed 30 minutes

Maximum Marks 15

Q # 01: Write True or False? i) ii) iii) iv) The body of main function in enclosed by ( ) Header file conio.h is used for input / output functions >, >=, <, <=, = = and ! = are logical operators. When arguments are passed by a value, the function works with the original arguments in the calling program. v) vi) vii) viii) ix) x) Q # 02: i) ii) iii) iv) v) vi) vii) viii) ix) A comma is used to separate three parts of loop statements is for loop. A variable of type char can hold 2 bytes in the memory. Two variables can be declared in one statement. The break statement causes an exit from the program An expression containing && operator is true if either or both of its operands are true. The default case required in the switch selection structure is optional. Fill in the blanks _________ .h is the header file used clrscr ( ) function.. ___________ Operator assigns Right value to Left value. The expression 11%4 evaluates to ________________ Operating system works as an interface between _______ and __________ An statement in C++ is terminated by _______________ The closing brace of structure is followed by ____________ The first line of function definition is referred to as the ______ The default case required in the switch selection structure is _____________ . The programs that translate high level language into machine language are called _____________. x) Function __________ is used to produce random numbers.

Q # 3 Encircle the correct answer:

i)

The ____________ program transfers the executable image of a C ++ program from disk to memory. a. compiler b. loader c. linker The key word void is used to indicate that a function ___________ a value. a. b. c. does not return return find

ii)

iii)

iv)

The key word _____________ introduces a structure definition. a. if else b. switch c. struct A pointer is _______ a. the address of the variable b. variable for storing address c. structure tag The number used to refer to a particular value of an array is called its ________. a. superscript b. subscript c. tag

v)

Q # 4 Do as directed. 1. How many time the loop will execute for ( int i = 1 ; i < = 20 ; i +3 ) 2. Find the error if any and correct. double cube ( float num ) { num * num * num ; } 3. What will be the output of int x = 2; while ( y < 10 ) { x + = y; y++; } 5. Write the c ++ statement for a) z = x 3 + tan ( u 2 + v 2 ) e x y b) x=-b+b24ac 2a

Vous aimerez peut-être aussi