Sei sulla pagina 1di 26

‫)‪Computer Laboratory (I & II‬‬

‫‪2019-2020‬‬
‫‪First Class‬‬

‫تجارب مختبر الحاسبات للمرحلة األولى وللكورسين‬


‫(األول والثاني) متضمنة الطرق األجرائية والطرق البديلة‬
‫المراد تطبيقها وحسب المنهاج االتي‪ :‬الكونات المادية‬
‫للحاسوب ‪ ،‬نظام التشغيل (‪ ، )Windows 7‬برنامج‬
‫الطباعة (‪ )Microsoft Word‬ولغة البرمجة ‪. C++‬‬

‫مشرف المختبر‪:‬‬
‫م‪ .‬عامد أمحد حسني‬
‫مهندس المختبر‪:‬‬
‫همندس أقدم‪ .‬نور صباح عبود‬
1- Introduction to Computers By Gordon B. Davis
2- Borland C++ Builder By Herbert Schmidt
3- Shaum’s Programming with C++ ,2nd Edition, By John R. Hubbard
4- C / C++ Programmers References By Herbert Schmidt
5- C++ By Dissection By Ira Pohl
6- A C++ Primer for Engineers An object – Oriented Approach By
K.Ponnambalam & Tiuley Alguindigue

1
Test-1 1- ‫األختبار‬

Write down the name of the following parts:

____________________ ____________________ ____________________

Sub Test-1 1- ‫البديل‬

Define the following:

1. CPU
2. GB
3. ROM
4. USB
5. Hard Disc
6. Mother Board
7. TB
8. CD

Test-2 2- ‫األختبار‬

Fill in the blanks:

1. CPU speed is measured in ____________________ and a memory is measured in ____________________.


2. A power supply converts ____________________ current to ____________________ current.
3. Generally, there are two types of memories, ____________________ and ____________________

Sub Test-2 2- ‫البديل‬

Give the abbreviations of the following:


1. random access memory = ____________________
2. central processing unit = ____________________
3. gigahertz = ____________________
4. universal serial bus = ____________________
2
Test-1 1- ‫األختبار‬

Fill the following blanks :

1. Generally The PC desktop contain the following elements: …………… , …………… , …………..
2. ……………………… Change settings and customize the functionality of your computer.
3. The taskbar contains: ……………… , ………………..
4. A file is commonly referred to as a …………….. while a folder is a ……………..
5. To copy a file or folder you must press ……….. from keyboard then press …………. In the new location

Sub Test-1 1- ‫البديل‬

Choose the correct answer :

1. To open a folder, we ____________ it.

(a) click (b) drag (c) double-click

2. The folder ____________ is used to quickly access storage device (Hard Disk, Floppy Disk).

(a) Documents (b) My Computer (c) Recycle Bin

3. ____________ sub menu close all opened programs, shut down Windows and then turn off your computer.

(a) Shut down (b) Restart (c) Sleep

Test-2 2- ‫األختبار‬

Fill in the blanks:

1. A deleted file is stored in a temporary place called ________________________________.


2. We change the settings of a computer from ________________________________ sub menu.
3. To change a file name, we click ____________________ from the right-click shortcut menu.
4. To delete a file, we press ____________________ button on the keyboard.
5. To cut a file or a folder we press (ctrl + _______ ).

Sub Test-2 2- ‫البديل‬

What do the following icons indicate?

1.

2.

3
3.

4.

Test-1 1- ‫األختبار‬

Fill the following blanks:

1. The MS Word is a product of ………………… company.


2. The option ………………. is responsible of bolding the wrote word.
3. The Insert menu has the following options : ……………… , ……………….. , ……………..
4. I can save the word file using the …………….. menu, then ………………..
5. We can draw any table using ………………. in ……………. Menu.
6. The paper size can be adjusted using ……………. Option.

Sub Test-1 1- ‫البديل‬

1. The option (word count) is located on ____________ .


(a) Status Bar (b) View Toolbar (c) Quick Access Bar
2. ____________ gives you the choice of where and how to save the file.
(a) Save (b) Save as (c) Open
3. When I finished writing this examination form, I pressed the Hotkey ____________ to print it.
(a) ctrl+v (b) ctrl+p (c) ctrl+b

Test-2 2- ‫األختبار‬

What do the following icons indicate?

1. 1.

2.

3.

4.

4
Sub Test-2 2- ‫البديل‬

Fill the following blanks:

1. The indication (Page: 3 of 13) in the (word count) option indicates that there are __________ pages and the
user is at page ____________ .
2. We can draw a table using the Insert menu then click insert table.
3. Red wavy (zigzag) underline indicates _________________ errors, while green wavy underline indicates
_________________ errors.
4. The Bold, Italic and Underline icons work like __________ and __________ switches.

Test-1 1- ‫األختبار‬

Write a C++ program to calculate a sum of two numbers:

Sub Test-1 1- ‫البديل‬

Write a C++ program to divide two numbers and add the result to another number and print the
result to screen:

Test-2 2- ‫األختبار‬

Write a C++ to calculate the area of a circle:

Sub Test-2 2- ‫البديل‬

Write a C++program to calculate the area and circumference of a triangle:

Test-1 1- ‫األختبار‬

Write a C++program to read four degrees then calculate sum and average of them.

Sub Test-1 1- ‫البديل‬

5
Write a C++ program to read a Fahrenheit degree and convert it to Celsius degree using the
conversion formula:

C 
5
( F  32)
9
Test-2 2- ‫األختبار‬

Write a C++ program to calculate a and b from the equations:


5 x y 4.5( x  2.3 y)
a  and b 
z 2.7 w zw

Sub Test-2 2- ‫البديل‬

Write a C++ program to read two boolean values( a and b) then print “OR” and “AND” them.

Test-1 1- ‫األختبار‬

Write a C++ script to represent the following keys using logical operators:
Var1 Var1 Var3
Var3 Var4
c d
Var2 Var2 Var4

Enter Var1 to Var4 as a boolean values.

Sub Test-1 1- ‫البديل‬

Write a C++ script to represent the following keys using logical operators:

Var1
Var1 Var2 Var3
Var5 Var2
Var3 Var4
Var4

Enter Var1 to Var5 as a boolean values.

6
Test-2 2- ‫األختبار‬

Write a C++ program to read two numbers and print the value of the greater one (using ternary
operator).

Sub Test-2 2- ‫البديل‬

Write a C++ program to read a numbers then check if it an even or odd number (using ternary
operator).

Test-1 1- ‫األختبار‬

If you know that the radius of the circle inscribed in triangle with sides a, b, c is:
(s  a)(s  b)(s  c) 1
r where s  (a  b  c)
s 2

Sub Test-1 1- ‫البديل‬

Give the C++ expression of the following equation:

𝒙𝟐 𝒚 − 𝟑 𝒔𝒊𝒏 𝒙
𝑨=
√ 𝒙𝟑
𝒚

Test-2 2- ‫األختبار‬

Write a C++ program to computes and print all the arithmetic expressions in same program.

1  op1  2 ln( x 3 )
2  op 2  e x  sin 2 ( x)
3

x3  4x 2  x
3  op3  2
x  2x  2

7
Test-1 1- ‫األختبار‬

The following series is an approximation for computing the natural logarithm of a


value x:
1 1 1
log x  ( x  1)  ( x  1)2  ( x  1)3  ( x  1)4
2 3 4
Write a C++ program to find and print the logarithmic value of any entered
number according to this series.

Sub Test-1 1- ‫البديل‬

Write a C++ program to find the two solution of the quadratic equation ax2+bx+c
using the quadratic formula:
−𝑏 ∓ √𝑏2 − 4𝑎𝑐
𝑥1,2 =
2𝑎

Test-1 1- ‫األختبار‬

Write a program to calculate the distance between two points using the following
(ax  bx) 2  (ay  by) 2  (az  bz ) 2
equation: d=

Sub Test-1 1- ‫البديل‬

8
Write a C++ program to enter any two angles (a and b) in radian unit then find
and print the value of (Z) from the below equation in radian and degree unit:
b
Z  Sin (a 2 )  Tan 3 ( )
3
Test-2 2- ‫األختبار‬

Write a C++ program to find and print (y) from the following equation:
y  3 sinh 1 (u)  u cosh 1 (u)

If you know that: sinh 1 (u)  ln(u  u 2  1) and cosh 1 (u)  ln(u  u 2  1)

Test-1 1- ‫األختبار‬

Write a C++ program to find and print the Area and the Perimeter (circumference)
for the shape below from the following equations:

θ ø

Enter any unknown variables.


1
Hint: csc( ) 
sin( )

Sub Test-1 1- ‫البديل‬

Write a C++ program to find and print Y from the following equation:

Y  4 x 2  2 sinh(x)  cosh 2 (x)  6


9
ex  e x ex  e x
If you know that:: Sinh(x)= and Cosh(x)=
2 2
Enter any unknown variables.

Test-1 1- ‫األختبار‬

Write C++ program to read a real number and print (positive) when it is greater
than zero and negative otherwise:

Sub Test-1 1- ‫البديل‬

Write a C++ program to read a number and print its type (even or odd).
Test-2 2- ‫األختبار‬

Write a C++ program to read two numbers and print the value of the greater one:
Sub Test-1 1- ‫البديل‬

Write a C++ program to read two numbers and an operation to apply it on them:

Test-1 1- ‫األختبار‬

Write a C++ program that read the primary (basic) salary and the sales and
calculate the total salary which equals the basic salary plus the commission that is
calculated as:
Comm=2% if the sales are less than or equal three times of the basic salary.
Comm=3% if the sales are more than three times of the basic salary.
Comm=5% if the sales are more than five times of the basic salary.
10
Sub Test-1 1- ‫البديل‬

Write a C++ program to calculate y from the equation:

(3x  7) if ( x  5) 
 2 
y= (5 x ) if ( x  2) or ( x  5) 
( x  4 x 3 ) if ( x  4)or ( x  4)
 

Test-2 2- ‫األختبار‬

Write a C++ program to calculate the sum and average of six students degrees and
print the appropriate grade in the screen using (switch) statement:
Degree grade

0 - 49 Fail
50 - 59 Accept
60 - 69 Fluent
70 - 79 Good
80 - 89 Very good
90 - 100 Excellent

Sub Test-2 2- ‫البديل‬

If you know that the Tax office takes a tax for the imported goods according to
their degrees as shown in the Table:
Goods degree Tax
Write a C++ program to enter the goods degree
“A” 40% from price
and price then print the tax according to the table
“B” 10% from price
above.
“C” 5% from price
“D” 2% from price
“E” 1% from price
11
Test-1 1- ‫األختبار‬

Use (switch) to write a C++ program to make a mini calculator for the four
operations(+ , - , / , *).
Sub Test-1 1- ‫البديل‬

Write a program to read a triangle three sides and print " equilateral" when all the
sides are equal and print "isosceles" when two sides are equal and print "scalene"
when all the sides are different:

Test-2 2- ‫األختبار‬

Write a Program to read a character if it's in alphabet then find if its uppercase or
lowercase. If it’s a digit print that it is a digit. Else print that it’s a special
character.

Test-1 1- ‫األختبار‬

Write a C++ program to enter four numbers then find the minimum one:

Sub Test-1 1- ‫البديل‬

Write a C++ program to find z from the below equations depending on your entry
(k). Use switch.
2k  sin(k ) :k 1
 3
2 k  3 :k  2
z
k  2 :k 3
k : k  1 or k  3

12
Test-2 2- ‫األختبار‬

Write a C++ program to design a scientific calculator to choose the trigonometric


functions: Sin, Cos, Tan, Sec, or Csc. Choose Radian or degree. Use (switch) twice.

Sub Test-2 2- ‫البديل‬

The solution(s) to the quadratic equation is given by the quadratic formula:


−𝑏 ∓ √𝑏2 − 4𝑎𝑐
𝑥1,2 =
2𝑎
But this will not apply if (a) is zero, so that condition must be checked separately.
The formula also fails to work (for real numbers) if the expression under the square
root (b2-4ac) is negative. Write a C++ program to find the solution under these
conditions.

Test-1 1- ‫األختبار‬

Write a C++ program to read 20 integer numbers, then print.


a) Number of even numbers.
b) Sum of even numbers.
c) Number of odd numbers.
c) Sum of odd numbers.

Sub Test-1 1- ‫البديل‬

Write a C++ program to read ten numbers and calculate the sum and average of
them using (for) statement.

13
Test-2 2- ‫األختبار‬

Write a C++ to print the following numbers using for loop:


1 10 100 1000 10000
2 20 200 2000 20000
3 30 300 3000 30000
4 40 400 4000 40000
5 50 500 5000 50000
Sub Test-2 2- ‫البديل‬

Write a C++ program in C++ to print the numbers between 1 and 50 that are
dividable on 3 using (while) statement:

Test-1 1- ‫األختبار‬

Write a C++ program to calculate the factorial of a number after reading it:

Sub Test-1 1- ‫البديل‬

Write a C++ program in C++ to print the numbers between 1 and 10 using (Do-
While) statement:

Test-2 2- ‫األختبار‬

Write a C++ program to calculate the summation of the numbers: 4 , 4.5 , 5 , … ,


9.5 , 10

Sub Test-2 2- ‫البديل‬

Write a C++ program to read a number and calculate if it is prime or not:


14
Test-1 1- ‫األختبار‬

Write a C++ program to print the following pattern using For-statement.


1
333
55555
7777777
999999999
7777777
55555
333
1
Sub Test-1 1- ‫البديل‬

Write a C++ program to show the stars in the figure below:


****
***
**
*

Test-2 2- ‫األختبار‬

Write a C++ program to read (n) numbers and print the maximum one among
them.

Test-1 1- ‫األختبار‬

Write a program to solve the following series:


2𝑥 3𝑥 4𝑥 𝑛𝑥
𝑠=𝑥+ + + + ⋯+
2 3 4 𝑛
15
Sub Test-1 1- ‫البديل‬

Write a program to solve the following series:


2𝑥 3𝑥 4𝑥 𝑛𝑥
𝑠=𝑥+ + + + ⋯+
2! 3! 4! 𝑛!

Test-1 1- ‫األختبار‬

Write a C++ program that reads an integer array a[10] then find the max value
with its position and the min value with its position.

Sub Test-1 1- ‫البديل‬

Write a C++ program that inputs the integer array a[10] then transpose it and
print the transposed array.
Test-2 2- ‫األختبار‬

Write a C++ program to enter the array a(10), then find and print the first three
maximum numbers. Hint: Sort the array

Sub Test-2 2- ‫البديل‬

Write a C++ program to enter and print the two 1D arrays M[6] and N[6], then
find and print the value of P from the following equation:
5
P  2  M (i) * N (i)
i 0

where λ = 2.15* 10 -22

16
Test-1 1- ‫األختبار‬

Ten charges placed on a plate. Write a C++ program to enter the value for the ith
charge in an array q[10] and the distance from the center to the ith charge in
another array r[10] then find and print the electrical potential (E) in the center of
this plate according to the following equation:
1 qi
E
4 πε o
r , where εo = 8.85×10-12
i

Sub Test-1 1- ‫البديل‬

Write a C++ program to enter 10 degrees for 6 students in two subjects (physics
and mathematics). Store these degrees in two 1D arrays (P and M) then find and
print an array K that contains the mean between two opposite degrees.
Test-2 2- ‫األختبار‬

Write a C++program to split the odd number and even elements of a 2D array into
two 1D arrays.
Sub Test-2 2- ‫البديل‬

Write a C++ program to read 3×3 array then find the summation of each row, each
column and the whole array.

Test-1 1- ‫األختبار‬

Write a C++ program to sum two arrays and print the result array in a 2D matrix
form.

17
Sub Test-1 1- ‫البديل‬

Write a program in C++ to calculate the positive difference between two matrices
4X4 such that the result of the difference between any two corresponding numbers
in the arrays must be positive:
Test-2 2- ‫األختبار‬

Write a C++ program to find the summation of odd numbers in 4×4 array.

Sub Test-2 2- ‫البديل‬

Write a C++ program to find the “A” element in 4×4 character matrix then return
the index of its location.

Test-1 1- ‫األختبار‬

Write a program in c++ to convert 2D array to 1D array and fond the maximum
number in the new array:
Sub Test-1 1- ‫البديل‬

Write a program to read two 3*3 arrays and print a third array resulted from
multiplying the main diagonal elements of the two read arrays and subtract the
other elements of them each element with the corresponding one:
Test-2 2- ‫األختبار‬

Write a C++ program to read A[3,3] of numbers then find the minimum element
and print its location.
Sub Test-2 2- ‫البديل‬

Write a C++ program to read A[n,n] of numbers then find the maximum element
and print its location.
18
Test-1 1- ‫األختبار‬

Write a C++ program to read X[4,4] then exchanges the upper triangle with lower
triangle
Sub Test-1 1- ‫البديل‬

Write a C++ program to read b[4,4] then exchange the first row with the last row.
Test-2 2- ‫األختبار‬

Write a C++ program to read C[4,4] then exchange row0 with col3.
Sub Test-2 2- ‫البديل‬

Write a C++ program to replace each element in the main diagonal with the
elements in the second diagonal.

Test-1 1- ‫األختبار‬

Write a program to read two arrays and compare among each corresponding
elements in each of them to produce a new array of the larger correspond of the
two entered arrays:
Sub Test-1 1- ‫البديل‬

Write a C++ program that reads a square matrix with nine elements, then perform
the following menu depending on your entry:
1. Print the sum of main diagonal elements.
2. Print the sum of upper main diagonal triangle elements.
3. Set secondary diagonal elements to zero.
19
Test-1 1- ‫األختبار‬

Write a C++ program that adds two numbers of different numeric data types (e.g.
integers, float, double) using the function add().
Sub Test-1 1- ‫البديل‬

Write a C++ program that multiply five numbers of different numeric data types
(e.g. integers, float, double) using the function mul().
Test-2 2- ‫األختبار‬

Write a C++ program to enter any number then print the triple of this number. Use
the function Triple(n) to find the triple of any number.
Sub Test-2 2- ‫البديل‬

Write a C++ program that evaluates the trigonometric function secant (sec()) if you
know that: sec(x)= 1/cos(x).

Test-1 1- ‫األختبار‬

Write a C++ program that evaluates the function (fx()) if you know that:
fx(a,b)= sin 2(a)+ cos(b 3+3).
Sub Test-1 1- ‫البديل‬

Write a C++ program to enter two values (in feet and inch) representing a distance
then by using functions convert this distance to meters and centimeters. I you know
that: 1 foot=12 inch and 1 inch =2.54 cm

20
Test-2 2- ‫األختبار‬

Write a C++ program to enter one integer value representing time in seconds
distance then by using functions convert this time to equivalent hours, minutes, and
seconds. Print it in the following form: hr : mn : sec.
Sub Test-2 2- ‫البديل‬

Write a C++ program using function to input a student average and return 4 if the
average is 90-100, 3 if the average is 80-89, 2 if the average is 70-79, 1 if the
average is 60-69, and 0 if the average 0-59.

Test-1 1- ‫األختبار‬

Write a C++ program using function to calculate the factorial of an integer entered
number (n!).
Sub Test-1 1- ‫البديل‬

Write a C++ program using function to evaluate the following equation


x !  y!
z
( x  y )!
Test-2 2- ‫األختبار‬

Write a C++ program to implement the function NthRoot (x, N) to return the Nth
5
root for the argument (x) (i.e.
N
X ). Test the function by finding 16 .

Sub Test-2 2- ‫البديل‬

As you know that the function Log(x) returns the natural logarithm for argument (x)
(i.e. Ln(x)). Write a C++ program to implement the function LogEx(x,b) to find the

21
logarithm for the argument (x) with any base (b) then find and print Log4(9). Use
Ln( x)
the relation Logb ( x)  .
Ln(b)

Test-1 1- ‫األختبار‬

Write a C++ program to implement the function RndMinMax(Min, Max) to


generate a random number limited by the interval [Min, Max]. Test the function by
generating a number in the interval [2, 10].
Hint: Use the relation: rand( )%((maxi - mini) + 1) + mini
Sub Test-1 1- ‫البديل‬

Write a C++ program to implement the function tan -1(x) using the series:

1 x3 x5 x7 x9 x 99
tan (x)  x      ..... 
3 5 7 9 99
Input x and rename the function as invtan().

Test-2 2- ‫األختبار‬

Write a C++ program to implement the function ex using the series up to 100
terms:

x 2 x3 xn
e  1 x 
x
 ... 
2! 3! n!
Input x and rename the function as expx().

22
Test-1 1- ‫األختبار‬

Write a C++ program to evaluate the following by the use of user functions:
 1 x 1 x
3

 3 sinh ( 2 )  x cosh ( 2 )

 1 3
y   x sinh 1 ( )  2 cosh 1 ( )
 2 2
x
cos( 2 cosh 1 ( ))

 2

Find y for each entered value for the three equations at the same time.

Hint: sinh 1 (u)  ln(u  u 2  1) and cosh 1 (u)  ln(u  u 2  1)


Sub Test-1 1- ‫البديل‬

Write a C++ program to find and find Y from the following equation:
cosh(x)  4 sinh(x)
Y
1  3 sinh(x)  cosh 2 (x)

ex  e x ex  e x
Hint: Sinh(x)= and Cosh(x)=
2 2

23
Test-1 1- ‫األختبار‬

Write C++ program to apply the following instructions:str1=”abcd” and


str2=”1234”.
 strlen ( string )

 strcpy ( string2, string1)

 strcat ( string1, string2)

 strcmp ( string1, string2 )

Sub Test-1 1- ‫البديل‬.

Write C++ program to apply the following instructions: (a=”1234” and s=” “).
 atoi ( a )

 atof ( a )

 itoa ( 5678 , s ,10)

Test-2 2- ‫األختبار‬

Write C++ program to print an n-dimension character array contain character (a)
in the main diagonal, character (b) in the upper triangle and character (c) in the
lower triangle.

24
Test-1 1- ‫األختبار‬

Write C++ program to print a string, and then print it character by character in
forward and reveres order
i.e: abcd → a d
b c
c b
d a

Sub Test-1 1- ‫البديل‬.

write C++ program to enter the array s[10] then compute and print number of
character ”a” and number of character “b” that are repeated in this array .
Test-2 2- ‫األختبار‬

Write C++ program to enter a character array A[ 3][3 ] then put character “L”
instead of each lower case characters and “U” instead of upper case characters.

Sub Test-2 2- ‫البديل‬

Write C++ program to check each character in the string array A[3][3] to convert
the lower case letters to upper case letter and convert the upper case letters to
lower case.

25

Potrebbero piacerti anche