Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Chapter: 4
Q61:
What value of π (pi) is used in the circle calculation program?
A. 3.14159
B. 3.14
C. 3.142
D. 3.1
Correct Answer: B
Chapter: 4
Q62:
Which C++ header file is included at the beginning of the provided programs?
A. <stdio.h>
B. <iostream.h>
C. <math.h>
D. <stdlib.h>
Correct Answer: B
Chapter: 4
Q63:
In the context of operator precedence, which of the following has the highest precedence?
A. *
B. +
C. %
D. /
Correct Answer: A
Chapter: 4
Q64:
Which of the following is a valid statement to get input for a variable named age1 in C++?
A. cin << age1;
B. cin >> age1;
C. cout >> age1;
D. cout << age1;
Correct Answer: B
Chapter: 4
Q65:
What is the purpose of using parentheses in complex arithmetic expressions in C++?
A. To ignore the precedence of operators
B. To decrease code readability
C. To ensure correct order of evaluation
D. To increase the number of operations
Correct Answer: C
Chapter: 4
Q66:
If the user inputs the number 7531, what will be the first digit displayed by the program that separates digits of a 4-digit number?
A. 1
B. 7
C. 3
D. 5
Correct Answer: B
Chapter: 4
Q67:
Which of the following statements correctly computes the area of a circle in the circle calculation program?
A. area = 3.14 * radius * radius;
B. area = 2 * radius * 3.14;
C. area = 2 * 3.14 * radius;
D. area = radius * radius * 2;
Correct Answer: A
Chapter: 4
Q68:
What is the purpose of the modulus operator % in C++?
A. Division
B. Multiplication
C. To find the remainder after division
D. Addition
Correct Answer: C
Chapter: 4
Q69:
Which of the following is NOT a recommended practice mentioned in the tips?
A. Use descriptive names for variables
B. Indent the code for better readability
C. Use parentheses unnecessarily
D. Reuse variables for better memory usage
Correct Answer: C
Chapter: 4
Q70:
How is a variable reassigned a new value based on its previous value?
A. By using the assignment operator =
B. By using the equality operator ==
C. By using cin
D. By using cout
Correct Answer: A
Chapter: 5
Q71:
What is the purpose of an 'if' statement in C programming?
A. To execute a block of code based on a condition
B. To repeat a block of code multiple times
C. To terminate the execution of a program
D. To perform calculations
Correct Answer: A
Chapter: 5
Q72:
In the statement 'if (condition)', what will happen if the condition is true?
A. The statement or group of statements will execute
B. The condition will be checked again
C. The condition will be false
D. The program will terminate
Correct Answer: A
Chapter: 5
Q73:
What does the '==' operator signify in C?
A. Assignment operator
B. Equal to operator
C. Not equal to operator
D. Comparison operator
Correct Answer: B
Chapter: 5
Q74:
What will happen if you mistakenly use a single '=' instead of '==' in an 'if' condition?
A. It will give a syntax error
B. The condition will always be true
C. The condition will always be false
D. It will create a logical error
Correct Answer: D
Chapter: 5
Q75:
Which symbol is used to create a block of statements in C?
A. { } (curly braces)
B. () (parentheses)
C. [] (square brackets)
D. : : (colon)
Correct Answer: A
Chapter: 5
Q76:
What does the 'else' part of an 'if/else' structure represent?
A. It executes when the 'if' condition is false
B. It executes when the 'if' condition is true
C. It checks if the 'if' condition is true
D. It skips the rest of the program
Correct Answer: A
Chapter: 5
Q77:
In logical operators, what does the '&&' operator represent?
A. OR
B. AND
C. NOT
D. XOR
Correct Answer: B
Chapter: 5
Q78:
What will the '||' (OR) operator return if both expressions are false?
A. False
B. True
C. It will return True or False randomly
D. True and False are mixed
Correct Answer: A
Chapter: 5
Q79:
What does the '!' operator do in C?
A. It reverses the logical value of a condition
B. It checks if a condition is true
C. It assigns a value to a variable
D. It ends the program
Correct Answer: A
Chapter: 5
Q80:
What is the purpose of flowcharting in program design?
A. To visually design the sequence of instructions
B. To write the actual code of a program
C. To check the performance of the code
D. To convert code into machine language
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now