Control flow Questions
Computer Science 101 - Programming Fundamentals Past Papers
Practice 35 past-paper questions for Control flow in Computer Science 101 - Programming Fundamentals. Get solutions and exam preparation resources.
Click on a question to view the full answer
1. Explain the difference between `if-else` and `switch-case` statements in programming. When would you use each?
View
2. Write a program to print the first 10 Fibonacci numbers using a `for` loop.
View
3. Write a program to check if a number is prime or not.
View
4. Explain the different types of decision making structures in the Python programming language with the help of proper syn…
View
5. What is machine cycle? Describe it in detail.
View
6. 6. Mark the correct output of the following code snippet.
int i = 10;
i=++i + ++i;
printf("%d", i);
a. 21
b. 23
c. 22…
View
7. 7. What is the output of the following code?
int x = 5 * 10 / 3 + 9;
printf("%d", x);
a. 21
b. 24
c. 23
d. 25
View
8. 8. Which keyword can be used for coming out of recursion?
a. break
c. return
b. exit
d. both break and return
View
9. Write in brief about conditional operators and logical operators with appropriate example.
View
10. What are control statements in programming? Discuss its types.
View
11. Write in brief about jump statements, discuss with appropriate examples.
View
12. The operator && is used for ________.
View
13. If x=7 and y=4 then the statement z=(x>y):x%y;
View
14. Which of the following is an unconditional control structure?
View
15. The loop in which the statements within the loop are not executed even at least once is called ________.
View
16. Which of the following is true about if-else statement in C?
View
17. Which statement causes a particular group of statements to be chosen from several available groups?
View
18. What is the output of the following program?
```c
#include <stdio.h>
int main() {
int data = {-1, -3, -5, -6};
i…
View
19. What will be printed by the following code?
```c
#include <stdio.h>
void main(){
int i;
for(i=3;i<10;i=i+3)…
View
20. What is the output of the following program?
```c
#include <stdio.h>
int main(){
int i = 4;
do {
i++;…
View
21. Describe the usefulness of switch statement. Write a program that will read the value of x and evaluate the following fu…
View
22. Describe the syntax of do-while statement. The time period of a pendulum can be calculated using the equation. Write a p…
View
23. Describe with examples: a. Exception handling, b. Pure Virtual function
View
24. ### 3. What is the difference between while and for loops in C++?
Provide a full step-by-step solution.
View
25. 1. Which symbol is used for a condition statement in a flow chart?
View
26. 5. A structure can execute a set of statements only under certain circumstances, [ ] sequence [ ] circumstantial [ ] dec…
View
27. 14. Which statement immediately terminates a loop in Python? [ ] break [ ] continue [ ] exit [ ] stop
View
28. 18. In python programming, the concept of decision making or selection is implemented with the help of statement. [ ] wh…
View
29. Discuss why exception handling is important for robust programming?
View
30. 3. Create a Python program that prompts the user to enter values for variables a, b, and c. Use these values to solve a…
View
31. Difference between if and if... else statement in Python with flow chart. Write a program in Python to check whether the…
View
32. What is the primary purpose of the if statement in Python?
View
33. What will be the output of the following code? x=50 if x>10 and x < 15: print ('true') elif x > 15 and x < 25: print ('n…
View
34. What is the output of the following code? counter = 1 sum = 0 while counter <= 5: sum = sum + counter counter = counter…
View
35. 20. _______________ keyword is used to take the control to the beginning of the loop?
View
Sponsor Space