Q1) What is the simplest selection structure
- Switch
- If
- If - else
- Nested If
Answer:If
Explanation:The simplest selection structure in programming is the "if statement". The if statement is a programming construct that allows a program to make a decision based on a condition. It evaluates a Boolean expression and executes a block of code if the expression is true.
Q2) How many kinds of control structures
- 3
- 2
- 5
- 6
Answer:3
Explanation:There are three main kinds of control structures in programming: selection structures, iteration structures, and sequence structures.
Selection structures:
Iteration structures:
Sequence structures:
Q3) An if statement inside another if statement Is
- If- Statement C)
- Nested if statement
- Switch statement
- Defaukt
Answer:Nested if statemen
Explanation:A nested if statement is an if statement that is placed inside another if statement. This is a way of adding more conditions to an if statement, allowing a program to make more complex decisions based on multiple conditions.
Q4) Which keyword is not used in switch statemewe
- Case
- Default
- If
- Switch
Answer:If
Explanation:If
Q5) Arother term for conditional operator is:
- Ternary
- Binary
- Iteration
- Byte
Answer:Ternary
Explanation:The conditional operator are also known as the ternary conditional operator, evaluates a Boolean expression and returns the result of one of the two expressions,
Q6) Choose an alternative to the If-else statement from the following
- Logical operator
- Relational operator
- Conditional operator
- Arithmetic
Answer:Conditional operator
Explanation:The conditional operator, also known as the ternary operator, is another alternative to the if-else statement. It is a concise way of writing a simple if-else statement and can be used in many programming languages, including C and C++.
Q7) Which keyword is used for loop?
- if
- While
- loop
- Nested
Answer:while
Explanation:while
Q8) Which of the following are valid case statements in switch
- case x < 5
- case 'ab'
- Case ¢
- case 1.5;
Answer:case 'ab'
Explanation:case 'ab'
Q9) In If-statement false represented by:
- 0
- 1
- 2
- 3
Answer:0
Explanation:0 Represents the off Or False Situation in digital devices
Q10) Which operator in C is called ternary operator?
- +
- ?
- if
- --
Answer:?
Explanation:The ternary operator in C is the conditional operator, also known as the "?:" operator. It is called the ternary operator because it takes three operands: a condition, a value to return if the condition is true, and a value to return if the condition is false.
Q11) Which programming structure makes a comparison?
- Decision
- Relation
- Sequence
- Repetition
Answer:Relation
Explanation:A selection structure, such as the if statement or the switch statement, is a programming structure that makes a comparison. These structures allow a program to check a condition or make a decision based on the value of a variable or expression.
Q12) Another term for computer making a decision is:
- Sequence
- Iteration
- Selection
- Repetition
Answer:Selection
Explanation:"selection" is another term for computer making a decision.
Q13) In If-statement, true is represented by:
- 1
- 0
- 2
- 00134
Answer:1
Explanation:1
Q14) The conditional operator is used as alternate to:
- If
- else
- If- else
- Switch
Answer: If- else
Explanation: If- else
Q15) Conditional operator takes:
- Two
- Three
- One
- four operand
Answer:Three
Explanation:The conditional operator, also known as the ternary operator, takes three operands. The first operand is a Boolean expression or condition that is evaluated to either true or false. The second operand is the value that is returned if the condition is true, and the third operand is the value that is returned if the condition is false.
Q16) If a relational expression is true, It has a value:
- .0
- 1
- -1
- None of these
Answer:1
Explanation:1
Q17) An expression that uses a relational operator represented by: (A) (B) (C) !
- Sequential
- Serials
- Operational
- Relational
Answer:Relational
Explanation:An expression that uses a relational operator compares two values and returns a Boolean value (either true or false) based on the result of the comparison. Relational operators are symbols used in programming languages to compare values.
> : greater than
< : less than
>= : greater than or equal to
<= : less than or equal to
== : equal to
!= : not equal to
Q18) Graphical representation of a program is called:
- Logic chart
- Binary chart
- Flow chart
- E-R chart
Answer: Flow chart
Explanation: A flowchart is a graphical representation of a process or algorithm that uses symbols and arrows to show the sequence of steps or actions. Flowcharts are used in computer programming, business processes, and other fields to help visualize complex processes and identify areas for optimization or improvement.
Q19) Which of the given is used for making two way decision?
- If See
- if-else
- Nested If
- Switch
Answer: if-else
Explanation: if-else
Q20) Which of the following is the simplest form of the decision structure?
- If Statement
- if-else
- Nested if
- Switch
Answer: if
Explanation: if
Q21) Switch statement is an alternative of:
- If- else
- nested -if
- if- else
- If
Answer:If-else
Explanation:The switch statement is an alternative to the if-else statement in programming. Both the switch statement and the if-else statement are selection structures that allow a program to make decisions based on the value of a variable or expression.
Q22) Which of the following is valid case statement in a switch statement:
- Case 1:
- Casex<1:
- Casex>1:
- Case 1.5:
Answer:Case 1:
Explanation:Case 1: Conceptual. The keyword case and then its id or identifer
Q23) The last statement of each case block in switch () structure must be:
- Default
- End Select
- Break
- End
Answer:Default
Explanation:The default case in a switch statement is not considered as a case block, so it does not require a break or a return statement at the end.
Q24) The case block in switch () structure ends with:
- Default
- End Select
- Break
- End
Answer:Break
Explanation:Break
Q25) This statement causes a loop to terminate early:
- Exit
- Break
- None of these
- Terminate
Answer:Break
Explanation:In programming, the break statement is used to terminate the execution of a loop, a switch statement or a labeled block.
0 Comments