0% found this document useful (0 votes)
18 views13 pages

Cos 122 70Q

The document contains a series of questions and answers related to problem-solving approaches, algorithms, programming concepts, and C programming basics. Key topics include the steps in problem-solving, algorithm design methods, programming language types, control statements, and variable types in C. It serves as a study guide for understanding fundamental programming concepts and practices.

Uploaded by

Bright Igbako
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views13 pages

Cos 122 70Q

The document contains a series of questions and answers related to problem-solving approaches, algorithms, programming concepts, and C programming basics. Key topics include the steps in problem-solving, algorithm design methods, programming language types, control statements, and variable types in C. It serves as a study guide for understanding fundamental programming concepts and practices.

Uploaded by

Bright Igbako
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DR LEO’S COS 122 Questions and Answers

1. Which of the following is the first step in approaching a problem?


a) Formulate a Model
b) Understand the Problem
c) Develop an Algorithm
d) Write the Program
Answer: b) Understand the Problem
2. After understanding the problem, what is the next step in problem-solving?
a) Write the Program
b) Test and Debug the Program
c) Formulate a Model
d) Evaluate the Solution
Answer: c) Formulate a Model
3. Developing an algorithm comes after which step in the problem-solving
approach?
a) Understand the Problem
b) Formulate a Model
c) Write the Program
d) Test and Debug the Program
Answer: b) Formulate a Model
4. Which step involves converting an algorithm into executable code?
a) Formulate a Model
b) Develop an Algorithm
c) Write the Program
d) Test and Debug the Program
Answer: c) Write the Program
5. What is the final step in the problem-solving approach?
a) Write the Program
b) Test and Debug the Program
c) Evaluate the Solution
d) Develop an Algorithm
Answer: c) Evaluate the Solution
6. What is a property of an algorithm discussed in this chapter?
a) Efficiency
b) Representation
c) Properties of an Algorithm
d) Approaches to Algorithm Design
Answer: c) Properties of an Algorithm
7. Which approach to algorithm design starts from a general idea and breaks it
down into smaller parts?
a) Bottom-Up Approach
b) Top-Down Approach
c) Efficiency of Algorithm
d) To analyse an Algorithm
Answer: b) Top-Down Approach
8. What is a method for representing algorithms?
a) Efficiency of Algorithm
b) Flowcharts
c) To analyse an Algorithm
d) Approaches to Algorithm Design
Answer: b) Flowcharts
9. Pseudocode is a representation method for:
a) Problem Solving
b) Algorithms
c) Programs
d) Data Structures
Answer: b) Algorithms
10.Which method for representing algorithms uses graphical symbols to depict the
flow of control?
a) Pseudocode
b) Decision Tables
c) Flowcharts
d) Top-Down Approach
Answer: c) Flowcharts
11.Decision Tables are discussed as a method for:
a) Analysing algorithms
b) Designing algorithms
c) Representing algorithms
d) Evaluating solutions
Answer: c) Representing algorithms
12.The "Bottom-Up Approach" is a concept related to:
a) Algorithm representation
b) Algorithm analysis
c) Algorithm design
d) Algorithm properties
Answer: c) Algorithm design
13.Which strategy involves simplifying a complex problem by focusing on essential
features?
a) Analogical Reasoning
b) Brainstorming
c) Abstraction
d) Trail and Error
Answer: c) Abstraction
14.Drawing parallels between a new problem and a previously solved one is
known as:
a) Brainstorming
b) Analogical Reasoning
c) Hypothesis Testing
d) Reduction
Answer: b) Analogical Reasoning
15.What problem-solving strategy involves generating a large number of ideas
without immediate judgment?
a) Trail and Error
b) Hypothesis Testing
c) Brainstorming
d) Literal Thinking
Answer: c) Brainstorming
16.Which strategy involves trying different solutions until one works?
a) Hypothesis Testing
b) Reduction
c) Trail and Error
d) Means-Ends Analysis
Answer: c) Trail and Error
17.Testing a potential explanation or solution to see if it holds true is part of:
a) Reduction
b) Hypothesis Testing
c) Literal Thinking
d) Focal Objects
Answer: b) Hypothesis Testing
18.What strategy involves breaking down a large problem into smaller, more
manageable sub-problems?
a) Root Causes Analysis
b) Proof
c) Divide and Conquer
d) Heuristic
Answer: c) Divide and Conquer
19."Means-Ends Analysis" is a problem-solving strategy that focuses on:
a) Identifying the root causes
b) Reducing the difference between the current state and the goal state
c) Generating new ideas
d) Proving a solution's correctness
Answer: b) Reducing the difference between the current state and the goal
state
20.Which strategy aims to find the underlying reasons for a problem?
a) Research
b) Root Causes Analysis
c) Proof
d) Heuristic
Answer: b) Root Causes Analysis
21.What is a strategy that involves proving the correctness of a solution?
a) Divide and Conquer
b) Heuristic
c) Proof
d) Analogical Reasoning
Answer: c) Proof
22.A "Heuristic" is a problem-solving strategy that:
a) Guarantees an optimal solution
b) Provides a rule of thumb for finding a solution
c) Requires formal proof
d) Is only used for simple problems
Answer: b) Provides a rule of thumb for finding a solution
23.What does "Literal Thinking" imply in problem solving?
a) Thinking outside the box
b) Focusing on abstract concepts
c) Interpreting things exactly as they are stated
d) Using analogies
Answer: c) Interpreting things exactly as they are stated
24.What refers to the environment in which programming takes place?
a) Programming Language
b) Computer Program
c) Programming Environment
d) Good Programming Convention
Answer: c) Programming Environment
25.What are guidelines for writing clear and maintainable code?
a) Programming Language
b) Programming Environment
c) Good Programming Convention
d) Computer Program
Answer: c) Good Programming Convention
26. Which type of programming language is closer to machine code?
a) High-Level Languages
b) Interpreted Language
c) Low-Level Languages
d) Compiled Language
Answer: c) Low-Level Languages
27. Languages like Python or JavaScript, which are executed line by line, are often
categorized as:
a) Compiled Language
b) High-Level Languages
c) Low-Level Languages
d) Interpreted Language
Answer: d) Interpreted Language
28. Which type of language is translated into machine code before execution?
a) Interpreted Language
b) Low-Level Languages
c) Compiled Language
d) High-Level Languages
Answer: c) Compiled Language
29. What is a fundamental concept in Object-Oriented Programming?
a) Low-Level Languages
b) Interpreted Language
c) Objects
d) Compiled Language
Answer: c) Objects
30. Blueprints for creating objects are known as:
a) Objects
b) Encapsulation
c) Classes
d) Inheritance
Answer: c) Classes
31.The bundling of data and methods that operate on the data within a single unit
is called:
a) Inheritance
b) Polymorphism
c) Encapsulation and Data Abstraction
d) Classes
Answer: c) Encapsulation and Data Abstraction
32.The ability of an object to take on many forms is referred to as:
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
Answer: c) Polymorphism
33. What is a benefit of Object-Oriented Programming (OOP)?
a) Increased code complexity
b) Reduced reusability
c) Advantages of Object-Oriented Programming (OOP)
d) Slower execution
Answer: c) Advantages of Object-Oriented Programming (OOP)
Answer: b) Programming Language
34.What is the process of converting C code into an executable program?
a) Creating and Running a C Program
b) Compilation Process in C
c) Executing a C Program
d) Programming Paradigms in C
Answer: b) Compilation Process in C
35.What helps in understanding the purpose of different parts of a C program
without affecting its execution?
a) Executive Flow of a C Program
b) Understanding Comments in C
c) Programming Errors
d) Character Set
Answer: b) Understanding Comments in C
36.What are the predefined reserved words in C?
a) Identifiers
b) Variables
c) Keywords
d) C Literals
Answer: c) Keywords
37.What are named memory locations used to store data that can change during
program execution?
a) Constants
b) C Literals
c) Identifiers
d) Variables
Answer: d) Variables
38.What are fixed values that do not change during program execution?
a) Variables
b) C Literals
c) Constants
d) Keywords
Answer: c) Constants
39.int, float, and char are examples of:
a) Operators
b) Basic Data Types
c) C Literals
d) Keywords
Answer: b) Basic Data Types
40. Operations like addition, subtraction, multiplication, and division are
performed by:
a) Relational Operators
b) Logical Operators
c) Arithmetic Operators
d) Assignment Operators
Answer: c) Arithmetic Operators
41.The ++ and -- symbols represent which type of operators?
a) Assignment Operators
b) Relational Operators
c) Increment and Decrement Operator
d) Bit-Wise Operators
Answer: c) Increment and Decrement Operator
42.Which operators are used for comparison, such as == or >?
a) Logical Operators
b) Bit-Wise Operators
c) Relational Operators
d) Arithmetic Operators
Answer: c) Relational Operators
43.Which statement allows a program to execute a block of code only if a specified
condition is true?
a) if...else Statement
b) switch Statement
c) if Statement
d) Nested if...else
Answer: c) if Statement
44.Which statement provides two blocks of code, one for when a condition is true
and another for when it's false?
a) if Statement
b) switch Statement
c) Nested if...else
d) if...else Statement
Answer: d) if...else Statement
45.What is it called when an if...else statement is contained within another if or
if...else statement?
a) switch Statement
b) Program Loops
c) Nested if...else
d) while Loop
Answer: c) Nested if...else
46. Which statement is used for multi-way branching based on the value of an
expression?
a) if Statement
b) if...else Statement
c) switch Statement
d) Nested if...else
Answer: c) switch Statement
47.What type of control flow repeats a block of code multiple times?
a) Selection Statement
b) Program Loops and Iteration
c) C Functions
d) Control Statement
Answer: b) Program Loops and Iteration
48. Which loop executes a block of code as long as a specified condition remains
true?
a) do...while Loop
b) for Loop
c) while Loop
d) Nested if...else
Answer: c) while Loop
49. Which loop guarantees that its block of code will be executed at least once?
a) while Loop
b) for Loop
c) do...while Loop
d) if Statement
Answer: c) do...while Loop
50. What type of loop is typically used when the number of iterations is known
beforehand?
a) while Loop
b) do...while Loop
c) for Loop
d) Selection Statement
Answer: c) for Loop
51. Reusable blocks of code that perform a specific task are known as:
a) Program Loops
b) C Functions
c) Control Statement
d) Selection Statement
Answer: b) C Functions
52.What kind of functions are pre-defined in the C library?
a) User defined function
b) Monolithic Functions
c) Standard Library Functions
d) Recursive Functions
Answer: c) Standard Library Functions
53.A declaration that tells the compiler about a function's name, return type, and
parameters is called a:
a) Function call
b) Function definition
c) Function prototype
d) Return Statement
Answer: c) Function prototype
54. The process of passing values to a function when it is called is known as:
a) Returning a value
b) Calling a function
c) Passing arguments to a function
d) Defining a function
Answer: c) Passing arguments to a function
55. What statement is used to send a value back from a function to the calling
code?
a) Calling a function
b) Passing arguments
c) Return Statement
d) C Recursion
Answer: c) Return Statement
56.What is the process where a function calls itself?
a) Modular Programming
b) Standard Library Functions
c) C Recursion
d) User defined function
Answer: c) C Recursion
57.Variables declared inside a function are known as:
a) Global Variable
b) Register Variable
c) Local Variable
d) Static Variable
Answer: c) Local Variable
58.Variables declared outside of any function and accessible throughout the
program are:
a) Local Variable
b) Register Variable
c) Global Variable
d) Static Variable
Answer: c) Global Variable
59.What type of variable is stored in the CPU registers for faster access?
a) Local Variable
b) Global Variable
c) Register Variable
d) Static Variable
Answer: c) Register Variable
60."Monolithic Vs Modular Programming" is discussed within the context of:
a) Control Statements
b) C Functions
c) Programming Errors
d) Algorithm Design
Answer: b) C Functions
61.What is the purpose of "C Storage Class"?
a) To define the scope and lifetime of variables
b) To specify the data type of variables
c) To perform arithmetic operations
d) To control program flow
Answer: a) To define the scope and lifetime of variables
62.Which statement is an example of a selection control statement?
a) for Loop
b) while Loop
c) if Statement
d) do...while Loop
Answer: c) if Statement
63.What is the characteristic of "Program Loops and Iteration"?
a) They select one of several code blocks to execute.
b) They allow a function to call itself.
c) They repeat a block of code multiple times.
d) They define the scope of variables.
Answer: c) They repeat a block of code multiple times.
64."Global Variable" is a type of variable discussed under which topic?
a) C Functions
b) Program Loops
c) C Storage Class
d) Selection Statement
Answer: c) C Storage Class
65.Which of the following is not a type of storage class mentioned?
a) Local Variable
b) Static Variable
c) Global Variable
d) Register Variable
Answer: b) Static Variable
66."Polymorphism" is a concept related to:
a) Control Statements
b) Object-Oriented Programming
c) C Programming Basics
d) Algorithm Design
Answer: b) Object-Oriented Programming
67.Which of the following is considered an "identifier" in C?
a) int
b) return
c) main
d) float
Answer: c) main
68.What is the purpose of a "variable" in C programming?
a) To perform arithmetic operations
b) To store a fixed value that cannot change
c) To reserve a named memory location to store data that can be changed
d) To define the structure of a program
Answer: c) To reserve a named memory location to store data that can be
changed
69.Which of the following is a correct way to declare an integer variable named
count in C?
a) count int;
b) int count;
c) integer count;
d) declare count as int;
Answer: b) int count;
70.What does the term "C Literals" refer to?
a) Predefined keywords in C
b) Named memory locations
c) Fixed values that are directly represented in the source code
d) Operations performed on data
Answer: c) Fixed values that are directly represented in the source code

You might also like