COS121 Past Question

UNIUYO COS121 Past Questions and Answers; meticulously compiled to supercharge your academic success

Control structures in Visual Basic programming includes the following except (a) While loop (b) Do while loop (c) For each loop (d) None of above

(d) None of above
All the options listed (While loop, Do while loop, For each loop) are valid control structures in Visual Basic. Since all the options are correct, the answer is “None of above.”

Which of these lines of code accept any key from the keyboard, and exits visual basic console Widow (a) console. ReadLine() (b) console. ReadNext() (c) console. Readkey() (d) console.read()

(c) console.ReadKey()
console.ReadKey() accepts any key from the keyboard and waits for a key press before continuing or closing the console window. It’s commonly used to pause the console so the user can see the output before the window closes.

If K =2, i = 0, j = 8; what datatype will be the value of the code snippet: console.WriteLine((x <> y) AND (i<= j )). (a) Boolean (b) Float (c) Double (d) Integer (e) Error

(a) Boolean

The expression console.WriteLine((x <> y) AND (i <= j)) involves a logical comparison. Since the AND operator is used and it results in either True or False, the data type is Boolean.

Which of these options is not a valid datatype in Visual Basic (a) Boolean (b) String (c) float (d) object

(c) float

In Visual Basic, the correct name for the floating-point data type is Single or Double, not float. Therefore, float is not a valid Visual Basic data type.

  1. Given that num variable is 110, What will be the output of the if…then… else block?

If num <=100 then

Num =num*2;

Elseif num >110

Num= num *3;

Endif

(a) 110 (b) 220 (c) 330 (d) no output

(a) 110

Given that num = 110, the condition num <= 100 is false, so the program skips the first block. The next condition num > 110 is also false. Therefore, no change is made to num, and the output remains 110.

In the Visual Basic application, which of the following are listed in a properties window? (a) Items (b) Values (c) Attributes (d) Objects (e) Files

(c) Attributes
The Properties window in Visual Basic lists attributes (properties) of the selected object, like text, color, size, etc. Items, Values, Objects, and Files are not specifically listed in the Properties window.

Which of the following displays list of projects is contained in the Visual Basic current solution? (a)List Window (b) Project window (c) Catalogue window (d) Solution Explorer Window

(d) Solution Explorer Window
The Solution Explorer window displays all projects and files in the current Visual Basic solution. It’s used to navigate between different parts of a project.

Which of the following instruction tells the computer to close the current form in Visual Basic? (a) This.Close() (b) Me.Close() (c) Close.this() (d) Close()

(b) Me.Close()
Me.close() is the correct syntax in Visual Basic to close the current form. Me refers to the current instance of the form.

Which of the following is the default name assigned to the label control in Visual Basic? (a) Label (b) DefaultLabel (c) NewLabel (d) Labell

(a) Label
The default name assigned to a new label control in Visual Basic is “Label” followed by a number (e.g., Label1, Label2). The other options are not default names.

Which of the following toolbox is used to include an image on the Visual Basic? (a) Add image box (b) Picture Box (c) Add picture Box (d) Image box

(b) Picture Box
The Picture Box control in Visual Basic is used to display images. Other options like Add image box and Image box are not actual Visual Basic controls.

In visual basic language what are the rules of a programming language called? (a) Grammar (b) Order (c) Syntax (d) RulesA

(c) Syntax
In programming, the rules and structure of writing code are referred to as syntax. The other options do not specifically refer to the rules of a programming language.

Which of the following is used to display a message box in visual basic? (a) MessageBox.Show (b) MessageBox.show (c) MessageBox (d) AlertBox.View

(b) MessageBox.show
Explanation: MessageBox.show (with correct capitalization) is the method used to display a message box in Visual Basic.

In visual basic, which function is used to return a copy string without trailing space? (a) LTrim (b) RTrim (c) Trim (d) a and b

(b) RTrim
Explanation:RTrim removes trailing spaces from a string. LTrim removes leading spaces, and TRim removes both leading and trailing spaces.

In Visual Basic, which of these will the value not change during program execution? (a) Const rest (b) dim rest As integer (c) dim rest As string (d) dim rest As char

(a) Const rest
Explanation: A constant (Const) is a variable whose value cannot change during the execution of a program, making option (a) correct.

The graphical representation  of  step-by-step approach to problem solving is ——— (a) algorithm (b) pie chart (c) flowchart (d) process

(c) flowchart
Explanation: A flowchart is a graphical representation of a step-by-step approach to solving a problem, typically using various symbols.

The decision symbol in a flow chart is defined using a___________ shape (a) square (b) rectangle (c) Diamond (d) Oval

(c) Diamond
Explanation: The decision symbol in a flowchart is represented by a diamond shape, which is used to denote a decision point.

The condition is checked at the end of the loop is a characteristics of_______ (a) while loop (b) for loop (c) Do-while (d) None

(c) Do-while
Explanation: In a Do-while loop, the condition is checked at the end of the loop, which allows the loop to execute at least once.

The primary decision-making capability in BASIC programming is provided by the ——– (a) IF – statement (b) FOR -statement (c) WHILE -statement (d) PRINT

(a) IF – statement
Explanation: The IF statement is the primary decision-making capability in Visual Basic, allowing the program to choose between different paths.

What is the first step in the problem-solving process? (a) Identify the problem (b) Implement the solution (c) Evaluate the result (d) Choose a random approach

(a) Identify the problem: The first step in the problem-solving process is to clearly identify the problem. This step is crucial to finding an effective solution.

What does brainstorming involve in the context of problem-solving? (a) Narrowing down ideas (b) Generating a variety of ideas (c) Selecting the best solution immediately (d) Ignoring creative input

(b) Generating a variety of ideas: Brainstorming involves generating a wide range of ideas without immediately evaluating them, allowing for creative and diverse solutions.

What is a common obstacle to effective problem-solving? (a) Flexibility (b) Creativity (c) Lack of information (d) Open-mindedness

(c) Lack of information: A common obstacle to effective problem-solving is a lack of sufficient information, which can hinder the ability to make informed decisions.

The most effective strategy in solving a problem is: (a) to follow the maxim: the shortest distance between two point is a straight line (b) to work backward from the goal (c) to form subgoal (d) dependent on the problem

(d) dependent on the problem: The most effective problem-solving strategy depends on the specific nature of the problem. Sometimes working backward, forming subgoals, or other strategies may be more appropriate.

________ problem requires the identification of the best solution to a search problem from a given set of solution: (a) Search (b) counting (c) Undecidable (d) Optimization

(d) Optimization: An optimization problem involves finding the best solution from a set of possible solutions. This type of problem requires considering various factors to achieve the optimal outcome.

Two common methods of representing an algorithm are___________ (a) Pseudocode and flowchart (b) Flowchart and model (c) Pseudocode and mathematical function (d) Mathematical function and flowchart

(a) Pseudocode and flowchart: Pseudocode and flowcharts are two common methods used to represent algorithms. Pseudocode uses structured language, while flowcharts use visual diagrams.

One of these is not a characteristics of an algorithm (a) Finiteness (b) Logical (c) Effectiveness (d) Definiteness

(b) Logical: An algorithm must be logical, with clear, unambiguous steps. This ensures that the algorithm can be followed correctly to achieve the desired result.

Which area of computing can heuristic algorithm be found? (a) Artificial Intelligence (b) Natural language processing (c) Big Data Analysis (d) All of these.

(d) All of these.: Heuristic algorithms, which are used to find approximate solutions to complex problems, can be found in various areas of computing, including Artificial Intelligence, Natural Language Processing, and Big Data Analysis.

Two common methods of representing an algorithm are __________ (a) Pseudocode and Flowchart (b) Flowchart and model (c) Pseudocode and Mathematical Function (d) Mathematical Function and Flowchart

(a) Pseudocode and Flowchart: This is the same as question 24. Pseudocode and flowcharts are commonly used to represent algorithms.

One of these is NOT a step in problem analysis (a) understanding the problem (b) Breaking the problem (c) Defining problem goal (d) Merging the problem

(d) Merging the problem: Merging the problem is not a step in problem analysis. Problem analysis typically involves understanding the problem, breaking it down, and defining the problem’s goal.

Problem solving tools can be any of the following EXCEPT (a) Linear programming (b) Queueing systems (c) Simulation (d) Alpha beta

(d) Alpha beta: Alpha-beta pruning is a search algorithm used in artificial intelligence, particularly in game theory. It is not typically considered a general problem-solving tool like linear programming, queuing systems, or simulation.

________is the process the computer takes to convert a high-level programming language (a) Coding (b) Compilation (c) Programming (d) Documentation

(b) Compilation: Compilation is the process by which a computer converts a high-level programming language into machine code that the computer can execute.

One of these is NOT a valid variable name in BASIC programming (a) bassey, (b) ba_ssey (c) 2bassey, (d) base3y.

(c) 2bassey: In BASIC programming, variable names cannot start with a number. Therefore, “2bassey” is not a valid variable name.

One of these is NOT a BASIC programming keywords (predefined functions) (a) COS (b) DATA (c) NEXT (d) SCH

(d) SCH: “SCH” is not a predefined keyword in BASIC programming, whereas COS, DATA, and NEXT are.

Which of these operations has the highest hierarchy of operations? (a) Division (b) Parenthesis (c) Subtraction (d) Addition

(b) Parenthesis: Parentheses have the highest precedence in the hierarchy of operations, ensuring that expressions within parentheses are evaluated first.

Which of these is NOT a core concept in computing (a) Process (b) Input (c) Document (d) Output

(c) Document: Document is not considered a core concept in computing. Core concepts typically include processes like Input, Processing, and Output.

_______  uses the structure of formal programming languages and mathematics to break the algorithm into one -sentence steps. (a) Flowchart (b) Pseudocodes (c) Compiler (d) Interpreter.

(b) Pseudocodes: Pseudocode uses the structure of formal programming languages and mathematics to break down algorithms into one-sentence steps, making it a useful tool for planning and designing algorithms.

You’ve done an excellent job studying past questions and answers—this is a crucial step in preparing for any exam. Now, it’s time to take your learning to the next level by practicing with quizzes. Quizzes provide an interactive way to reinforce what you’ve learned, helping to solidify your knowledge and improve your recall.

By testing yourself with quizzes, you can identify areas where you need more practice, boost your confidence, and ensure you’re fully prepared for the real exam. So, after reviewing the past questions, challenge yourself with a quiz. It’s not just about knowing the answers—it’s about mastering the material.

Take the time to practice, and you’ll be better equipped to tackle any question that comes your way on exam day.

Similar Posts