Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS201-Most Importants MCQs on Control Structures and Structured Flowcharting

Control Structures and Structured Flowcharting
Q#1: What is the purpose of braces in the if code block?
(A) To make the condition true
(B) To execute the if code block
(C) To transfer control to the else part
(D) Both b and c are correct
Answer: (D) Both b and c are correct

Q#2: When is it optional to use braces in the else part?
(A) When there is a single statement inside the else part
(B) When the condition is false
(C) When there is a nested if statement
(D) Braces are always mandatory in the else part
Answer: (A) When there is a single statement inside the else part

Q#3: What is the recommended programming practice regarding the use of braces?
(A) Use braces only in the if code block
(B) Use braces only in the else code block
(C) Use braces all the time
(D) Use braces only for complex conditions
Answer: (C) Use braces all the time

Q#4: How do we handle complex conditions in an if statement?
(A) Use nested if statements
(B) Use braces in the else part
(C) Use logical connectives like && and ||
(D) Both a and c are correct
Answer: (D) Both a and c are correct

Q#5: What does structured flowcharting recommend regarding the left side of the flowchart?
(A) Always go to the left of the straight line
(B) Never go to the left of the straight line
(C) It depends on the program logic
(D) Left side is irrelevant in flowcharting
Answer: (B) Never go to the left of the straight line

Q#6: Which loop variant is executed at least once before the condition is evaluated?
(A) While Loop
(B) Do-While Loop
(C) For Loop
(D) Nested Loop
Answer: (B) Do-While Loop

Q#7: When are braces mandatory in the while loop?
(A) When there is a single line inside the while code block
(B) When the condition is false
(C) When there are multiple lines of code inside the while code block
(D) Braces are never mandatory in the while loop
Answer: (C) When there are multiple lines of code inside the while code block

Q#8: What is the syntax for the do-while loop?
(A) while ( condition ) { // Do something }
(B) do { // Do something } while ( condition )
(C) for ( initialization; condition; increment ) { // Do something }
(D) do { // Do something } for ( condition )
Answer: (B) do { // Do something } while ( condition )

Q#9: How many times are the statements inside the while code block executed if the while condition is false from the beginning?
(A) 0 times
(B) 1 time
(C) n times
(D) Infinite times
Answer: (A) 0 times

Q#10: What is the purpose of the for loop in programming?
(A) To execute code only once
(B) To gather three things together
(C) To terminate the program
(D) To evaluate a single condition
Answer: (B) To gather three things together

Q#11: When are braces not mandatory in the for loop?
(A) When there is a single statement in the for code block
(B) When there is a complex condition
(C) When there is an else part
(D) Braces are always mandatory in the for loop
Answer: (A) When there is a single statement in the for code block

Q#12: What does the exit symbol in flowcharts represent?
(A) End of the program
(B) End of the loop
(C) Exit condition in the if statement
(D) End of the code block
Answer: (A) End of the program

Q#13: What is the significance of the left margin in structured flowcharting?
(A) It represents the logical flow of the program
(B) It is irrelevant in flowcharting
(C) It is the boundary of the screen, and indentation is made towards the right side
(D) It determines the direction of the flowchart
Answer: (A) It represents the logical flow of the program

Q#14: How is the do-while loop different from other loops?
(A) It executes only once
(B) It evaluates the condition before execution
(C) It is recommended for complex conditions
(D) It doesn’t require braces
Answer: (A) It executes only once

Q#15: What is the role of logical connectives like && and || in programming?
(A) They determine the syntax of the if statement
(B) They are used in do-while loops
(C) They handle complex conditions in if statements
(D) They replace the need for braces
Answer: (C) They handle complex conditions in if statements

Q#16: In a nested if-statement, when is the code inside the nested if block executed?
(A) Only when the condition of the outer if is true
(B) Always
(C) Only when the condition of the inner if is true
(D) Never
Answer: (A) Only when the condition of the outer if is true

Q#17: According to the programming practice mentioned, what is the major advantage of using structured flowcharting?
(A) It reduces the need for braces
(B) It improves program readability and logical soundness
(C) It simplifies complex conditions
(D) It eliminates the need for nested if statements
Answer: (B) It improves program readability and logical soundness

Q#18: What is the primary purpose of loops in programming?
(A) To execute code once
(B) To simplify complex conditions
(C) To handle decision structures
(D) To perform repetitive tasks
Answer: (D) To perform repetitive tasks

Q#19: How does the for loop terminate?
(A) When the condition is false
(B) When the condition is true
(C) When the loop reaches the exit symbol
(D) When the program encounters an error
Answer: (A) When the condition is false

Q#20: What is the relationship between flowcharts and code in structured flowcharting?
(A) Flowcharts represent a different logic than the actual code
(B) There is no relationship between flowcharts and code
(C) Flowcharts provide a logical depiction of the solution, and there is one-to-one correspondence between flowchart segments and code
(D) Flowcharts are optional and not necessary for writing code
Answer: (C) Flowcharts provide a logical depiction of the solution, and there is one-to-one correspondence between flowchart segments and code

Contents Copyrights Reserved By T4Tutorials