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)
Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Kumar_niten
K
Kumar_niten
Community Contributor
Quizzes Created: 7 | Total Attempts: 76,246
Questions: 28 | Attempts: 10,343

SettingsSettingsSettings
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 the 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!


Programming Fundamentals Questions and Answers

  • 1. 

    Which of the following is NOT a type of algorithm?

    • A.

      Program

    • B.

      Flowchart

    • C.

      Decision Table

    • D.

      Pseudocode

    Correct Answer
    A. Program
    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.

    Rate this question:

  • 2. 

    The symbol that represents comments in a flowchart is

    • A.

      A procedure symbol

    • B.

      An annotation symbol

    • C.

      A flow line

    • D.

      A subroutine

    Correct Answer
    B. An annotation symbol
    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.

    Rate this question:

  • 3. 

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

    • A.

      Condition Applied

    • B.

      Condition Stub

    • C.

      Action Taken

    • D.

      Action Stub

    Correct Answer
    B. Condition Stub
    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.

    Rate this question:

  • 4. 

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

    • A.

      Procedure

    • B.

      Annotation

    • C.

      Decision

    • D.

      Subroutine

    • E.

      Process

    Correct Answer
    C. Decision
    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.

    Rate this question:

  • 5. 

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

    • A.

      Off-Page Connector

    • B.

      On-Page Connector

    • C.

      Annotation

    • D.

      Flow Line

    • E.

      Procedure

    Correct Answer
    A. Off-Page Connector
    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.

    Rate this question:

  • 6. 

    Which of the following statements is False?

    • A.

      The flowchart should be clear, precise and easy to follow

    • B.

      The input, process, output, and display symbols should have only one flow line.

    • C.

      Flowcharts can have only one start point and one endpoint

    • D.

      The start and stop symbols should have only a single flow line

    • E.

      In a flowchart all the necessary inputs should be listed out in a logical order

    Correct Answer
    B. The input, process, output, and display symbols should have only one flow line.
    Explanation
    The input, process, output, and display symbols can have multiple flow lines as they represent different steps in the flowchart.

    Rate this question:

  • 7. 

    Which of the following statements is true?

    • A.

      Pseudocode helps in understanding the logic better when compared to flowcharts

    • B.

      The flowcharts do not act as a guide during the program development phase

    • C.

      Flowcharts are a better method of communicating logic than pseudocode and decision tables

    • D.

      Flowcharts are a better technique to use in case of complex conditions compared to decision tables

    Correct Answer
    C. Flowcharts are a better method of communicating logic than pseudocode and decision tables
    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.

    Rate this question:

  • 8. 

    ____________ represent algorithms that involve complex decision-making.

    • A.

      Flowcharts

    • B.

      Decision Tables

    • C.

      Programs

    • D.

      Pseudocode

    Correct Answer
    B. Decision Tables
    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.

    Rate this question:

  • 9. 

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

    • A.

      Action Applied

    • B.

      Condition Stub

    • C.

      Action Stub

    • D.

      Condition Applied

    • E.

      Action Taken

    Correct Answer(s)
    B. Condition Stub
    C. Action Stub
    D. Condition Applied
    E. Action Taken
    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.

    Rate this question:

  • 10. 

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

    • A.

      Output

    • B.

      Input

    • C.

      Start

    • D.

      Subroutine

    • E.

      Decision

    Correct Answer
    B. Input
    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.

    Rate this question:

  • 11. 

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

    • A.

      Character n Gender

    • B.

      String sGender

    • C.

      Character cGender

    • D.

      Numeric nGender

    Correct Answer
    C. Character cGender
    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.

    Rate this question:

  • 12. 

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

    • A.

      25 = nAge

    • B.

      NAge = 25

    • C.

      NAge is 25

    • D.

      Display "Enter the age" Accept nAge

    • E.

      Set nAge to 25

    Correct Answer(s)
    B. NAge = 25
    D. Display "Enter the age" Accept nAge
    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.

    Rate this question:

  • 13. 

    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)

    • A.

      String nName = Tom

    • B.

      String nName = "Tom"

    • C.

      Character nName = Tom

    • D.

      Character nName = "Tom"

    • E.

      Character nName = 'Tom'

    Correct Answer
    B. String nName = "Tom"
    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.

    Rate this question:

  • 14. 

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

    • A.

      NBasic Salary

    • B.

      NBasicSalary

    • C.

      NBasic.Salary

    • D.

      NBasic_Salary

    • E.

      Basic Salary

    Correct Answer(s)
    B. NBasicSalary
    D. NBasic_Salary
    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.

    Rate this question:

  • 15. 

    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.

    • A.

      Statement 1 is false and Statement 2 is true

    • B.

      Both statements are false

    • C.

      Statement 1 is True and Statement 2 is false

    • D.

      Both statements are true

    Correct Answer
    C. Statement 1 is True and Statement 2 is false
    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.

    Rate this question:

  • 16. 

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

    • A.

      Operators

    • B.

      Values

    • C.

      Operands

    • D.

      Literals

    Correct Answer
    C. Operands
    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.

    Rate this question:

  • 17. 

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

    • A.

      0

    • B.

      5

    • C.

      Undefined

    • D.

      1

    Correct Answer
    A. 0
    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.

    Rate this question:

  • 18. 

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

    • A.

      Arithmetic operators

    • B.

      Logical operators

    • C.

      Relational operators

    • D.

      Special operators

    Correct Answer
    C. Relational operators
    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 ">", "=", "

    Rate this question:

  • 19. 

    Which of the following is a logical operator?

    • A.

    • B.

      And

    • C.

      ()

    • D.

      +

    Correct Answer
    B. And
    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.

    Rate this question:

  • 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?

    • A.

      Addition operator

    • B.

      Subtraction operator

    • C.

      Less than operator

    • D.

      All the three operators

    Correct Answer
    C. Less than operator
    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.

    Rate this question:

  • 21. 

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

    • A.

      =

    • B.

      %

    • C.

      !=

    • D.

      <=

    • E.

      *

    Correct Answer(s)
    A. =
    C. !=
    D. <=
    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.

    Rate this question:

  • 22. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    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.

    Rate this question:

  • 23. 

    Which operator has the highest precedence level?

    • A.

      ()

    • B.

      !

    • C.

      AND

    • D.

      *

    • E.

      %

    Correct Answer
    A. ()
    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.

    Rate this question:

  • 24. 

    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

    • A.

      9.5

    • B.

      0

    • C.

      90

    • D.

      25

    • E.

      60

    Correct Answer
    D. 25
    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.

    Rate this question:

  • 25. 

    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

    • A.

      NNum1 = 2, nNum2 = 3

    • B.

      NNum1 = 3, nNum2 = 3

    • C.

      NNum1 = 3, nNum2 = 2

    • D.

      NNum1 = 2, nNum2 = 2

    Correct Answer
    C. NNum1 = 3, nNum2 = 2
    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.

    Rate this question:

  • 26. 

    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

    • A.

      The result is even

    • B.

      The result is odd

    • C.

      Even

    • D.

      Odd

    • E.

      Nothing is displayed

    Correct Answer
    A. The result is even
    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".

    Rate this question:

  • 27. 

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

    • A.

      False

    • B.

      True

    Correct Answer
    B. True
    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.

    Rate this question:

  • 28. 

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

    • A.

      False

    • B.

      True

    Correct Answer
    A. False
    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.

    Rate this question:

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 +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.