Programming Fundamentals MCQ Quiz Questions And Answers

Reviewed by Godwin Iheuwa
Godwin Iheuwa, MS (Computer Science) |
Database Administrator
Review Board Member
Godwin Iheuwa, a Database Administrator at MTN Nigeria, holds an MS in Computer Science, specializing in Agile Methodologies and Database Administration from the University of Bedfordshire and a Bachelor's in Computer Science from the University of Port Harcourt. His proficiency in SQL Server Integration Services (SSIS) and SQL Server Management Studio contributes to his expertise in database management.
, MS (Computer Science)
By Kumar_niten
K
Kumar_niten
Community Contributor
Quizzes Created: 7 | Total Attempts: 83,747
| Attempts: 12,694 | Questions: 28
Please wait...
Question 1 / 28
0 %
0/100
Score 0/100
1. Which of the following is a logical operator?

Explanation

The logical operator "And" is used to combine two conditions in a logical expression. It returns true if both conditions are true, and false otherwise. This operator is commonly used in programming languages to create complex conditional statements and to control the flow of a program based on multiple conditions.

Submit
Please wait...
About This Quiz
Programming Fundamentals MCQ Quiz Questions And Answers - Quiz

Do you consider yourself a programmer? Do you know everything about programming fundamentals? Then take our brain-wracking programming fundamentals quiz and evaluate yourself. Programming can be defined as... see morethe art and science of translating an algorithm and encoding it into a script programmer. Algorithms are crucial in any programming that finds a solution to the problem. Let's start this MCQ quiz and see how much you know about this field. All the best!
see less

2. If x=2 NOT x=3 will result in:

Explanation

If x=2, it means that the value of x is 2. The statement "NOT x=3" means that x is not equal to 3. Since x is indeed 2 and not 3, the statement "x=2 NOT x=3" is true.

Submit
3. Is the following statement true or false? Statement: if constructs and switch...case constructs are decision-making constructs

Explanation

The statement is true because both if constructs and switch...case constructs are decision-making constructs in programming. The if construct allows for conditional execution of code based on a true or false condition, while the switch...case construct allows for multiple possible paths of execution based on the value of a variable or expression. Therefore, both constructs are used to make decisions and control the flow of a program.

Submit
4. Which operators are used to test the relationship between two variables or between a variable and a constant?

Explanation

Relational operators are used to test the relationship between two variables or between a variable and a constant. These operators compare the values of the variables or constants and return a boolean value (true or false) based on the comparison. Examples of relational operators include ">", "=", "

Submit
5. The symbol that represents comments in a flowchart is

Explanation

An annotation symbol is the correct answer because it is used in flowcharts to provide additional information or explanations about the flowchart or specific parts of it. It is typically represented by a rectangle with a dashed or dotted line, and it contains text that describes the purpose or functionality of the associated flowchart element. This symbol helps in enhancing the clarity and understanding of the flowchart by providing relevant comments or notes.

Submit
6. In the following expression z = x + y x and y are called:

Explanation

In the given expression, "z = x + y," x and y are referred to as operands. Operands are the variables or values that are used in an operation or calculation. In this case, x and y are the values being added together to calculate the value of z.

Submit
7. In a flowchart the symbol that represents a condition based on which a decision should be made is

Explanation

A flowchart is a graphical representation of a process or algorithm, where different symbols are used to depict different actions or steps. In this context, the symbol that represents a condition based on which a decision should be made is called a "Decision" symbol. This symbol is typically represented as a diamond shape in a flowchart. When the flowchart reaches a decision symbol, it evaluates a condition or criteria and based on the result, it determines which path to follow next in the flowchart.

Submit
8. Indicate whether the following statements are true or false. Statement 1: A variable needs to be declared before being used in a program Statement 2: A variable can be used without being initialized.

Explanation

In programming, it is necessary to declare a variable before using it, as stated in Statement 1. This means that the variable's type and name must be specified before it can be used in the program. On the other hand, Statement 2 is false because a variable cannot be used without being initialized. Initialization refers to assigning a value to the variable before it is used. Therefore, the correct answer is that Statement 1 is true and Statement 2 is false.

Submit
9. If 6 and 4 were entered respectively for number 1 and number 2 then what will be displayed when the following program executes? begin numeric nNum1, nNum2, nResult display “Enter number1 and number2 accept nNum1 accept nNum2 nResult = nNum1 + nNum2 if(nResult % 2 = 0) begin display “The result is even” end else begin display “The result is odd” end end

Explanation

When the program executes, it first prompts the user to enter number 1 and number 2. The values 6 and 4 are then entered respectively for number 1 and number 2. The program then calculates the sum of number 1 and number 2, which is 10. Since 10 is an even number, the condition in the if statement is true, and the program displays "The result is even". Therefore, the correct answer is "The result is even".

Submit
10. Which of the following is NOT a type of algorithm?

Explanation

A program is not a type of algorithm. An algorithm is a step-by-step procedure or set of rules for solving a problem, while a program is a set of instructions written in a specific programming language to be executed by a computer. Although a program may implement an algorithm, it is not considered a type of algorithm itself. Flowchart, decision table, and pseudocode, on the other hand, are different ways to represent algorithms.

Submit
11. What is the result of the following pseudocode? begin numeric nNum1, nNum2, nNum3, nResult nNum1 = 8 nNum2 = 9 nNum3 = 10 nResult = nNum1+nNum2*nNum3/45+15 Display nResult end

Explanation

The pseudocode calculates the value of nResult by performing a series of arithmetic operations. First, it multiplies nNum2 and nNum3, resulting in 90. Then, it divides the product by 45, resulting in 2. Finally, it adds nNum1 and the previous result, resulting in 25. Therefore, the correct answer is 25.

Submit
12. Which operator has the highest precedence level?

Explanation

The parentheses operator () has the highest precedence level. This means that any expression within parentheses will be evaluated first before any other operators. It is used to group subexpressions and override the default order of evaluation. By using parentheses, we can control the order in which operations are performed and ensure that certain calculations are prioritized.

Submit
13. Is the following statement true or false? Statement: The switch construct consists one case statement, a number of switch instructs, and a default statement

Explanation

The statement is false because the switch construct consists of one case statement, a number of case labels, and a default statement. The switch instructs mentioned in the statement are not part of the switch construct.

Submit
14. The accept keyword in a pseudocode is similar to the _____________ symbol in a flowchart.

Explanation

The accept keyword in pseudocode is used to indicate that the program should wait for user input. Similarly, the "Input" symbol in a flowchart represents the action of receiving input from the user. Both the accept keyword and the "Input" symbol serve the same purpose of allowing the program to interact with the user and obtain input values.

Submit
15. Which of the following statements is False?

Explanation

The input, process, output, and display symbols can have multiple flow lines as they represent different steps in the flowchart.

Submit
16. ____________ represent algorithms that involve complex decision-making.

Explanation

Decision Tables represent algorithms that involve complex decision-making. They are used to model complex logic and conditions in a structured and organized manner. Decision Tables provide a visual representation of all possible combinations of conditions and corresponding actions or outcomes. This allows for a systematic approach to decision-making and helps in identifying the most appropriate action based on various conditions. Therefore, Decision Tables are a suitable choice for representing algorithms that involve complex decision-making.

Submit
17. The part of a decision table in which all the conditions, based on which a decision is made are written is:

Explanation

The condition stub is the part of a decision table where all the conditions, based on which a decision is made, are written. It represents the set of conditions that need to be evaluated to determine the appropriate action to take. The condition stub acts as a placeholder for the conditions and helps organize the decision table by clearly defining the conditions that need to be considered.

Submit
18. Which of the following is/are valid variable name/s? (Choose all that apply)

Explanation

The valid variable names in the given options are "nBasicSalary" and "nBasic_Salary". Variable names can consist of letters, numbers, and underscores, but they cannot start with a number or contain spaces or special characters like periods. Therefore, "nBasic Salary" and "nBasic.Salary" are not valid variable names. "Basic Salary" is also not a valid variable name as it contains a space.

Submit
19. Study the following pseudocode -  begin numeric nNum1, nNum2, nNum3 nNum1 = 20 nNum2 = 4 nNum3 = nNum1 % nNum2 Display nNum3 end What will be the output?

Explanation

The output will be 0 because the % operator in programming represents the modulus operation, which calculates the remainder when one number is divided by another. In this case, nNum1 (20) is divided by nNum2 (4), and the remainder is 0. Therefore, the value of nNum3 will be 0, and it will be displayed as the output.

Submit
20. If an expression contains an addition operator, a less than operator, and a subtraction operator, which operator has a higher priority when evaluating the expression?

Explanation

In expressions with multiple operators, the order of operations determines the priority. Comparison operators, such as the less than operator (<), have a higher precedence than both addition (+) and subtraction (-) operators.

When evaluating an expression with a less than operator, it is evaluated after any addition or subtraction has occurred, but its result is prioritized when comparing values. The addition and subtraction operators have equal priority but lower than comparison operators.

Submit
21. Which symbol on a flowchart is used to represent the connection between the portions of a flowchart on separate pages?

Explanation

An off-page connector is used to represent the connection between the portions of a flowchart on separate pages. This symbol indicates that the flowchart continues on a different page and helps to maintain the flow and organization of the chart. It is commonly used when the flowchart becomes too complex to fit on a single page and allows for easier navigation and understanding of the process.

Submit
22. What are the values of nNum1 and nNum2 after the following program executes? begin numeric nNum1=2 numeric nNum2=3 numeric nSwap nSwap = nNum1 nNum1 = Num2 nNum2 = Num1 end

Explanation

Let's go through the code step by step:

nNum1 = 2 and nNum2 = 3 are initialized.

nSwap = nNum1 stores the value of nNum1 (which is 2) in the variable nSwap.

nNum1 = Num2 (this line seems to have a typo; it should be nNum1 = nNum2). So, this assigns the value of nNum2 (which is 3) to nNum1. Now, nNum1 = 3.

nNum2 = Num1 (again, there seems to be a typo, but it should mean nNum2 = nSwap). This assigns the value stored in nSwap (which is 2) to nNum2. Now, nNum2 = 2.

Thus, after the program executes, nNum1 = 3 and nNum2 = 2.

Submit
23. How would you declare a variable to store the gender of a person?

Explanation

The correct answer is "character cGender" because the question asks for a variable to store the gender of a person. The data type "character" is appropriate for storing a single character, which can represent the gender of a person (e.g., "M" for male, "F" for female). The variable name "cGender" is also suitable as it is clear and descriptive.

Submit
24. Which of the following statements is true?

Explanation

Flowcharts are a better method of communicating logic than pseudocode and decision tables because flowcharts provide a visual representation of the steps and decision points in a program, making it easier to understand the flow of logic. Pseudocode and decision tables, on the other hand, are more abstract and may require a deeper understanding of programming concepts to interpret. Additionally, flowcharts allow for easier identification of errors or inefficiencies in the logic, as they provide a clear visual representation of the program's structure.

Submit
25. A variable used to store the name of customers is to be declared. Which of the following declares the variable and intializes it to Tom? (Choose all that apply)

Explanation

In programming, string values are typically enclosed in double quotation marks to indicate that they are strings. So, the correct syntax is to use double quotation marks around "Tom" as shown in the example above.

Submit
26. Which of the following is/are relational operators? (Choose all that apply)

Explanation

Relational operators are used to compare values and determine the relationship between them. These operators include "=", "!=", and "<=".

"=" is used for equality comparison, "!=", for inequality comparison, and "<=" for less than or equal to comparison.

The "%" operator is the modulus operator used for finding the remainder of a division operation and is not a relational operator. Similarly, the "*" operator is the multiplication operator and is not a relational operator.

Submit
27. What are the four components of a Decision Table? (Choose all that apply)

Explanation

A Decision Table is a tabular representation of different conditions and corresponding actions. The four components of a Decision Table are: Condition Stub, which lists all the possible conditions or inputs; Action Stub, which lists all the possible actions or outputs; Condition Applied, which specifies the conditions that are relevant to each action; and Action Taken, which specifies the actions that are taken based on the conditions. These components help in organizing and analyzing complex decision-making processes.

Submit
28. A nAge variable is declared to store the age of a person. How would you intialize the variable to 25? (Choose all that apply)

Explanation

The correct answers are "nAge = 25" and "Display 'Enter the age' Accept nAge".


- "nAge = 25" assigns the value 25 to the variable nAge, initializing it to 25.
- "Display 'Enter the age' Accept nAge" prompts the user to enter the age and accepts the input into the variable nAge. This also initializes nAge to 25 if the user enters 25.

Submit
View My Results
Godwin Iheuwa |MS (Computer Science) |
Database Administrator
Godwin Iheuwa, a Database Administrator at MTN Nigeria, holds an MS in Computer Science, specializing in Agile Methodologies and Database Administration from the University of Bedfordshire and a Bachelor's in Computer Science from the University of Port Harcourt. His proficiency in SQL Server Integration Services (SSIS) and SQL Server Management Studio contributes to his expertise in database management.

Quiz Review Timeline (Updated): Sep 20, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Sep 20, 2024
    Quiz Edited by
    ProProfs Editorial Team

    Expert Reviewed by
    Godwin Iheuwa
  • Jun 03, 2008
    Quiz Created by
    Kumar_niten
Cancel
  • All
    All (28)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following is a logical operator?
If x=2 NOT x=3 will result in:
Is the following statement true or false? ...
Which operators are used to test the relationship between two...
The symbol that represents comments in a flowchart is
In the following expression z = x + y x and y are called:
In a flowchart the symbol that represents a condition based on which a...
Indicate whether the following statements are true or false. Statement...
If 6 and 4 were entered respectively for number 1 and number 2 then...
Which of the following is NOT a type of algorithm?
What is the result of the following pseudocode? begin numeric nNum1,...
Which operator has the highest precedence level?
Is the following statement true or false? ...
The accept keyword in a pseudocode is similar to the _____________...
Which of the following statements is False?
____________ represent algorithms that involve complex...
The part of a decision table in which all the conditions, based on...
Which of the following is/are valid variable name/s? (Choose all that...
Study the following pseudocode -  ...
If an expression contains an addition operator, a less than operator,...
Which symbol on a flowchart is used to represent the connection...
What are the values of nNum1 and nNum2 after the following program...
How would you declare a variable to store the gender of a person?
Which of the following statements is true?
A variable used to store the name of customers is to be declared....
Which of the following is/are relational operators? (Choose all that...
What are the four components of a Decision Table? (Choose all that...
A nAge variable is declared to store the age of a person. How would...
Alert!

Advertisement