Lab Work #1
Lab Work #1
Lab Work #1
IT department
Lab Work #1
Activity A
5. The computer stores a program while the program is running, as well as the data that the program is
working with, in __________.
6. This is a volatile type of memory that is used only for temporary storage while a program is running.
7. A type of memory that can hold data for long periods of time, even when there is no power to the
computer, is called __________.
8. A component that collects data from people or other devices and sends it to the computer is called
__________.
10. A __________ is enough memory to store a letter of the alphabet or a small number.
12. In the __________ numbering system, all numeric values are written as sequences of 0s and 1s.
13. A bit that is turned off represents the following value: __________.
a. 1 b. –1 c. 0 d. “no”
14. A set of 128 numeric codes that represent the English letters, various punctuation marks, and other
characters is __________.
15. An extensive encoding scheme that can represent characters for many languages in the world is
__________.
18. The tiny dots of color that digital images are composed of are called __________.
19. If you were to look at a machine language program, you would see __________.
20. In the __________ part of the fetch-decode-execute cycle, the CPU determines which operation it
should perform.
21. Computers can only execute programs that are written in __________.
22. The __________ translates an assembly language program to a machine language program.
23. The words that make up a high-level programming language are called __________.
24. The rules that must be followed when writing a program are called __________.
1. ( )Today, CPUs are huge devices made of electrical and mechanical components such as vacuum
tubes and switches.
3. ( )Any piece of data that is stored in a computer’s memory must be stored as a binary number.
4. ( )Images, like the ones you make with your digital camera, cannot be stored as binary numbers.
7. ( ) An interpreter is a program that both translates and executes the instructions in a highlevel
language program.
8. ( )A syntax error does not prevent a program from being compiled and executed.
9. ( )Windows Vista, Linux, UNIX, and Mac OSX are all examples of application software.
10. ( ) Word processing programs, spreadsheet programs, email programs, web browsers, and games
are all examples of utility programs.
Download C++ compiler, use Borland C-free compiler or any Borland C++ compiler that is
compatible with your machine(PC). You may download eclipse or NetBeans (IDE).
cin>>num1>>num2;
cout<<"”\nBefore swapping:\nNum1: "<<num1;
cout<<endl<<"num2: "<<num2;
swap(num1,num2); //function call
cout<<"”\n\nAfter swapping : \Num1: "<<num1;
cout<<endl<<"num2: "<<num2;
getch();
return 0 ;
}
//function fefinition swap()
void swap (int & a, int & b)
{
int temp=a;
a=b;
b=temp;
}
b. Add two more functions to your first program that you edited and tested:
First function to add the two number and second function to the determine the largest
number among the two.
c. Write and execute a function to compute Fibonacci series for n (say 50) terms. Fibonacci
series new number is always the sum of the two previous numbers 0+1 1, 1+1 2.
Get length
Get width
Display area
f. Repeat the rectangle program by defining rectangle as class in c++ using OOP paradigm.
==================================================================================
2. Download Python 3.10.2 on your machine, then try the following lab exercises
a. Use the Internet to research the history of the Python programming language, and answer
the following questions:
b. Who was the creator of Python?
c. When was Python created.
d. In the Python programming community, the person who created Python is commonly
referred to as the “BDFL.” What does this mean?
e. To make sure that you can interact with the Python interpreter, try the following steps on
your computer. Now, Start the Python interpreter in interactive mode.
f. Use the IDLE shell to test numeric and string operations.
>>> 21 + 450
>>> 23//2
>>>23/2
>>> 5 **3
>>> (5-2)*3/2
g. At the >>> prompt type the following statement and then press Enter:
If you see an error message, enter the statement again and make sure you type it exactly as
it should be.
h. Exit the Python interpreter. (In Windows, press Ctrl-Z followed by Enter. On other systems
press Ctrl-D.) 2. To make sure that you can interact with IDLE, try the following steps on your
computer:
Start IDLE. GUI To do this in Windows, click the Start button, then All Programs. In the Python
program group click IDLE (Python GUI).
i. Type the following program by creating a new file (name it: PyProgram1) and run it.
#Author: Ahmed
# date: 3/14/2022
# Description: program to compute the average of 3 scores...
#!/usr/bin/env python3
print("Hello out there!")
j. Type the following program save it as PyProgram2 and run it to see the results
#Author: Ahmed
# date: 3/14/2022
# Description: program to compute the average of 3 scores...
#!/usr/bin/env python3
# display a welcome message
print("The Test Scores program")
print()
print("Enter 3 test scores")
print("======================")
# get scores from the user
total_score = 0 # initialize the variable for accumulating scores
total_score += int(input("Enter test score: "))
total_score += int(input("Enter test score: "))
total_score += int(input("Enter test score: "))
# calculate average score
average_score = round(total_score / 3)
# format and display the result
print("======================")
print("Total Score: ", total_score,
"\nAverage Score:", average_score)
print()
print("Bye")
k. Exit IDLE by clicking File, then Exit (or pressing Ctrl-Q on the keyboard.