Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Highland College Bahir dar
Final exam for the course computer programming
Target Group : 1st year extension students of information technology department Time allowed: 1 :20 Weight: 50% Name: _________________________Id No: _______ I Choose the best answer and write the letter of your answer on provided space.(1 .5pts each) 1. One of the following is the correct syntax of for loop. A. For(initialization; increament/decreament; condition){ statement } B. For(initialization; condition; increament/decreament){ statment } C. For(condition; increment/ decreament; initialization){ statement } D. None 2. Identify the correct statement. A. Every c++ statement ends with semi colon B. Every c++ statement has main function C. Reserved word must be written in lowercase D. All 3. which of the following correct statement about comments in c++ ? A. All c++ Comments are not displayed when executed . B. All c++ comments are ignored by the compiler . C. C++ comments are written for the purpose of description . D. All 4. One of the following can be the correct declaration of variables. A. Int b; B. int a=40; C . Char name[10]; D. All 5. Int num1=10; Int num2=2; num3=num1+num2; what will be the output of the above program ? A. 12 B. 20 C. Error message D. none 6. …………is the graphical representation of flow data to solve a problem. A. Algorithm B. Pseudocode C. Flowchart D. all 7. What are keywords in c++ ? A. Can have a unique meaning in c++ B. Are written in lowercase C. keyword can not be variable name D. All 8. Float a=3.5; Float b=2; Int sum ; Sum=a+b; what will be the output of the above program ? A. 5.5 B.5 C. error message D. none 9. Which statement is most appropriate to develop grade report of a single student . A. If …… else B. Nested if C. If …. else if … else if… else D. Switch 10. ……… is the process of finding and correcting errors . A. Implementing B. Executing C. Debugging D. Coding 11. …….. is the type of error that attempts by the program to do something illegal while executing . A. Compile time error B. Logical error C. Run time error D. none 12. Among the following , one can be the correct c++ syntax to accept data or values from the keyboard . A. Cin<<variable name ; C. Cin>>variable name ; B. cout<<variable name ; D. cout>>variable name ; 13. Which of the following can be the incorrect statement about algorithm and pseudocode? A. Algorithm are written in programming languge. B. Both Pseuodocode and Algorithm can not be executed in real computer. C. Pseudocode can be written in natural languge. D. Algorithm has it,s own syntax and rules . 14. In the diagram of flowchart the decision is represented in ………. A. Rectangle B . diamond C. oval D. none II Match items of column “B”with items of column “A”. (1 .5pt each) you have a chance to select more than once in “B” column column A column B 1. Addition (+) A. arithmetic operator 2.Substraction (-) B. relational operator 3. Less than or equal (<=) C. logical operator 4. And (&&) 5. Less than (<) 6. Negation (!) III Write short and precise answer for the following questions. (2 pt each) 1. Define control statement . 2. What is the difference between selection and iteration statement ? 3. Describe the difference between single line comment and multiple line comment. 4. List and describe types of iteration statements. 5. Define computer programming . IV Write the correct c++ syntax that can solve the following problems 1. Write a c++ program that can add two numbers . accept the numbers from the keyboard .(3%) 2. Write a c++ program that can calculate the sum only even numbers from 1 up to n. accept the value of n from keyboard. (3%). 3. Write a c++ program that can display day of the week from Monday to Sunday.(4%) Hint :Use switch statement and declare the variable as dn switch(dn){ }