Injibara University
College of Engineering and Technology
Computer Programming [CoSc1012] worksheet
Program: Software Engineering, Number of Questions more than 200 all type Questions
Part I: Instruction: Multiple-Choice Questions. Give you justification
1. What is the primary function of a computer?
A) To create physical hardware.
B) To accept data, perform computations, and make logical decisions.
C) To act as a natural language translator.
D) To only store data without processing.
2. What are the instructions that tell a computer what to do called?
A) Hardware C) Compilers
B) Computer programs D) Processors
3. The process of writing, testing, debugging, and maintaining source code is _________
A) Designing C) Computer programming
B) Compiling D) System Analysis
4. Which of the following defines the structure of a programming language?
A) Syntax B) Semantics C) Logic D) Compilation
5. What is the role of semantics in a programming language?
A) To define the symbols used.
B) To check for spelling errors.
C) To handle the meaning given to a combination of symbols.
D) To convert code to machine language.
6. A step-by-step sequence of instructions that must terminate is____________
A) A program C) A flowchart
B) An algorithm D) A data structure
7. Which criteria ensures an algorithm terminates after a finite number of steps?
A) Definiteness C) Effectiveness
B) Finiteness D) Input
8. Which tool provides a schematic or diagram representation of an algorithm?
A) Pseudocode C) Flowchart
B) Structured Chart D) Compiler
9. What is Pseudocode?
A) A specific programming language like C++.
B) An informal high-level description of an algorithm for human reading.
C) Code that has been compiled.
D) A graphical representation of logic.
Computer Programming SEng. Set By Molla K. 1
10. A program is often defined as the combination of:
A) Logic + Hardware C) Syntax + Semantics
B) Data Structures + Algorithms D) Input + Output
11. What is the standard file extension for a C++ source code file?
A) .OBJ B) .EXE C) .CPP D) .H
12. Which component runs before the compiler to handle lines starting with #?
A) Linker C) Assembler
B) Pre-processor D) Debugger
13. Every C++ program must contain which function to start execution?
A) start () B) begin () C) main () D) Include ()
14. What is the smallest individual unit of a program meaningful to a compiler?
A) Sentence B) Token C) Block D) Function
15. Which of the following is a valid C++ identifier?
A) 2_variable B) my-variable C) _myVariable D) int
16. Which statement is used for a two-way branching decision?
A) if B) if-else C) switch D) goto
17. What happens in an else-if ladder when a true condition is found?
A) Corresponding statements execute and the rest are bypassed.
B) All subsequent conditions are still checked.
C) The program terminates immediately.
D) It returns to the first if statement.
18. Which structure is used for repeating a block of code until a condition is met?
A) Selection B) Branching C) Loop D) Declaration
19. What is an if statement inside another "if statement" called?
A) Doubled if B) Nested if C) Recursive if D) Parallel if
20. Which statement is used to divert the execution path to another part of the program?
A) Assignment B) Declaration C) Jumping D) Selection
21. An array is a collection of variables of:
A) Different types. C) Only integer types.
B) The same type. D) Variable lengths.
22. What is the index of the first element in a C++ array?
A) 0 B) 1 C) -1 D) The array size
23. How do you access the last element of an array named arr with 10 elements?
A) arr[10] C) arr[0]
B) arr[9] D) arr[size]
24. Global arrays are automatically initialized with what value?
A) Random garbage B) Zero C) One D) Null
25. What is the syntax for declaring an integer array of size 55?
A) int Student_list[55]; B) int [55] Student_list;
Computer Programming SEng. Set By Molla K. 2
C) Student_list int[55]; D) array int Student_list[55];
26. A group of statements that performs a specific task and is called by name is a_______
A) Variable B) Function C) Token D) Literal
27. What is the term for a statement that tells the compiler the function's return type and name?
A) Function body C) Function call
B) Function prototype D) Function argument
28. Temporary variable names within a function header are called___________
A) Parameters B) Arguments C) Literals D) Keywords
29. Which of the following is a benefit of using functions?
A) Increased program complexity.
B) Reusability (write once, read many times).
C) Slower execution time.
D) Eliminating the need for variables.
30. When a function calls itself, it is known as________________
A) Iteration B) Nesting C) Recursion D) Redirection
31. What type of programming language is C++?
A. Low-level B. High-level C. Assembly D. Machine language
32. What does IDE stand for?
A. Integrated Desktop Environment C. Integrated Development Environment
B. Internal Development Element
D. Intelligent Design Engine
33. Which of the following is an example of a C++ IDE mentioned in the text?
A. Visual Studio B. Turbo C++ C. Eclipse D. PyCharm
34. What is the first step to create an executable C++ file?
A. Link OBJ files
B. Compile source code
C. Create a source code file with .CPP extension
D. Run the program
35. What file extension is used for a compiled C++ source code file before linking?
A. .EXE B. .CPP C. .OBJ D. .H
36. The process of combining an OBJ file with libraries to produce an executable is called_____
A. Compiling B. Pre-processing C. Linking D. Assembling
37. What does an IDE provide to a programmer?
A. Only a text editor C. Tools to write, edit, compile, and run programs
B. Only a compiler D. Only a debugger
Computer Programming SEng. Set By Molla K. 3
38. Every meaningful C++ program must contain which function?
A. start() B. begin() C. main() D. include()
39. When does the pre-processor run?
A. After the compiler C. Before the compiler runs
B. During linking D. After the program starts
40. The include instruction tells the pre-processor to___________
A. Delete a file C. Encrypt the code
B. Find a filename and read it in at that location D. Skip the next line
41. What do angle brackets < > around a filename in an #include directive indicate?
A. The file is in the current project folder
B. The pre-processor should look in common library places
C. The file is a user-defined header
D. The file is optional
42. What is the purpose of iostream.h?
A. Mathematical calculations C. File management
B. Assisting with input/output to D. Memory allocation
the screen
43. What does the int in int main() indicate?
A. The function takes an integer as input
B. The function will return an integer value
C. The function is internal
D. The function is an interrupt
44. Which symbols are used to mark the beginning and end of a function block?
A. ( ) B. [ ] C. { } D. < >
45. Which object is used to print messages to the screen in C++?
A. cin B. print C. cout D. screen
46. What is the name of the << operator?
A. Input redirection operator C. Left shift operator
B. Output redirection operator D. Greater than operator
47. To print a literal string of characters, you must enclose them in:
A. Single quotes (')
C. Double quotes (")
B. Parentheses ( )
D. Braces { }
48. What do the characters \n tell cout to do?
A. Print a tab C. Put a new line
B. End the program D. Delete the previous character
49. What value is typically returned by main () to signal that a program terminated successfully?
Computer Programming SEng. Set By Molla K. 4
A. 1 B. -1 C. 0 D. NULL
50. What is the definition of compilation in C++?
A. Running the program C. Writing code in an editor
B. Converting source code into object
code
D. Debugging logical errors
Computer Programming SEng. Set By Molla K. 5