0% found this document useful (0 votes)
32 views

Pps QB

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Pps QB

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

MCQ ON SIMPLE IF AND IF-ELSE STATEMENTS

1. What will be the output of the following code?

Copy code
int x = 5;
if (x > 3) {
printf("Greater\n");
} else {
printf("Smaller\n");
}

a) Greater
b) Smaller
c) No output
d) Error

Answer: a) Greater

2. Which of the following is the correct syntax for an if statement in C?


3. a) if x > 0 then
b) if (x > 0)
c) if x > 0:
d) if {x > 0}

Answer: b) if (x > 0)

4. What will be the output of the following code?

int a = 10;
if (a == 10)
printf("Ten\n");
else
printf("Not Ten\n");

a) Ten
b) Not Ten
c) Error
d) No output

Answer: a) Ten

5. What is the result of the following code?

int b = 5;
if (b < 5)
printf("Less\n");
else if (b == 5)
printf("Equal\n");
else
printf("More\n");

a) Less
b) Equal
c) More
d) No output

Answer: b) Equal

6. Which of the following correctly handles a scenario with if and if-else?

int num = -1;


if (num > 0)
printf("Positive\n");
else
printf("Non-positive\n");

a) Positive
b) Non-positive
c) Error
d) No output

Answer: b) Non-positive

7. What is the purpose of the else statement in C? a) To handle conditions when if is


false
b) To initialize variables
c) To end a program
d) To create loops

Answer: a) To handle conditions when if is false

8. What will happen if the following code is executed?

int num = 10;


if (num = 5)
printf("Five\n");
else
printf("Not Five\n");

a) Five
b) Not Five
c) Error
d) Infinite loop

Answer: a) Five (due to assignment, it evaluates to true)


9. Which of the following will correctly compile?
10. a) if (5 > 3) { printf("True"); }
b) if 5 > 3 { printf("True"); }
c) if (5 > 3) printf("True")
d) if (5 > 3) : printf("True");

Answer: a) if (5 > 3) { printf("True"); } and c) if (5 > 3) printf("True")


(both are correct)

9. What will be the output of this code?

int score = 75;


if (score >= 90) {
printf("A\n");
} else if (score >= 80) {
printf("B\n");
} else if (score >= 70) {
printf("C\n");
} else {
printf("D\n");
}

a) A
b) B
c) C
d) D

Answer: c) C

MCQ ON ELSE IF AND NESTED IF

1. What will be the output of the following code?

int x = 20;
if (x < 10)
printf("Less than 10\n");
else if (x < 20)
printf("Less than 20\n");
else
printf("20 or more\n");

a) Less than 10
b) Less than 20
c) 20 or more
d) No output
Answer: c) 20 or more

2. Which of the following correctly illustrates a nested if statement?

if (a > 0) {
if (a < 10) {
printf("Single digit\n");
}
}

a) True
b) False
c) Error
d) It won't compile

Answer: a) True

3. What will be the output of the following code?

int y = 15;
if (y < 10) {
printf("Small\n");
} else if (y < 20) {
printf("Medium\n");
} else {
printf("Large\n");
}

a) Small
b) Medium
c) Large
d) No output

Answer: b) Medium

4. Which of the following will correctly compile and run?

if (x > 0) {
if (x == 1)
printf("One\n");
else
printf("Not one\n");
}

a) Correct
b) Incorrect
c) Error
d) Will produce no output

Answer: a) Correct
5. What will be the output of this code?

int a = 5;
if (a > 0) {
if (a < 3)
printf("Less than 3\n");
else
printf("Greater than or equal to 3\n");
} else {
printf("Negative\n");
}

a) Less than 3
b) Greater than or equal to 3
c) Negative
d) No output

Answer: b) Greater than or equal to 3

6. In the following code, what is the output when num is 8?

int num = 8;
if (num % 2 == 0) {
if (num > 10)
printf("Greater than 10\n");
else
printf("Even and less than or equal to 10\n");
} else {
printf("Odd\n");
}

a) Greater than 10
b) Even and less than or equal to 10
c) Odd
d) No output

Answer: b) Even and less than or equal to 10

7. What is the purpose of else if in C? a) To handle multiple conditions in a single if


statement
b) To create loops
c) To define functions
d) To end a program

Answer: a) To handle multiple conditions in a single if statement

8. What will the following code print if score is 85?

int score = 85;


if (score >= 90)
printf("A\n");
else if (score >= 80)
printf("B\n");
else if (score >= 70)
printf("C\n");
else
printf("D\n");

a) A
b) B
c) C
d) D

Answer: b) B

9. What is the output of this nested if statement?

int z = -5;
if (z < 0) {
if (z < -10)
printf("Less than -10\n");
else
printf("Between -10 and 0\n");
} else {
printf("Non-negative\n");
}

a) Less than -10


b) Between -10 and 0
c) Non-negative
d) No output

Answer: b) Between -10 and 0

MCQ ON SWITCH CASE STATEMENTS

1. What will be the output of the following code?

int x = 2;
switch (x) {
case 1:
printf("One\n");
break;
case 2:
printf("Two\n");
break;
default:
printf("Default\n");
}
a) One
b) Two
c) Default
d) No output

Answer: b) Two

2. Which of the following statements about switch is true?


3. a) switch can take any data type as an expression.
b) switch can only take integer or character expressions.
c) switch can handle floating-point numbers.
d) switch is the same as an if statement.

Answer: b) switch can only take integer or character expressions.

4. What will be the output of this code?

int num = 3;
switch (num) {
case 1:
printf("One\n");
break;
case 2:
printf("Two\n");
// No break here
case 3:
printf("Three\n");
break;
default:
printf("Default\n");
}

a) One
b) Two
c) Three
d) Two\nThree

Answer: d) Two\nThree

5. What happens if you omit the break statement in a switch case? a) The program will
crash.
b) It will skip to the next case and continue executing.
c) It will terminate the program.
d) Nothing; it behaves like an if statement.

Answer: b) It will skip to the next case and continue executing.

6. Which of the following is a valid way to use a switch statement?


int value = 5;
switch (value) {
case 1:
// code
break;
case 2:
// code
break;
default:
// code
}

a) Valid
b) Invalid due to no break in default
c) Invalid due to the data type of value
d) Invalid syntax

Answer: a) Valid

7. What will be the output of the following code?

char grade = 'B';


switch (grade) {
case 'A':
printf("Excellent\n");
break;
case 'B':
case 'C':
printf("Well done\n");
break;
case 'D':
printf("You passed\n");
break;
default:
printf("Invalid grade\n");
}

a) Excellent
b) Well done
c) You passed
d) Invalid grade

Answer: b) Well done

8. What will happen if the following code is executed?

int i = 1;
switch (i) {
case 1:
printf("Case 1\n");
case 2:
printf("Case 2\n");
break;
case 3:
printf("Case 3\n");
break;
default:
printf("Default case\n");
}

a) Case 1
b) Case 2
c) Case 1 Case 2
d) Case 1 Case 2 Default case

Answer: c) Case 1\nCase 2

9. In a switch statement, how many case labels can you have?


10. a) Only one
b) Any number of case labels
c) Up to 10
d) Two only

Answer: b) Any number of case labels

9. What is the output of the following code?

int day = 5;
switch (day) {
case 1:
printf("Monday\n");
break;
case 5:
printf("Friday\n");
break;
case 7:
printf("Sunday\n");
break;
default:
printf("Other day\n");
}

a) Monday
b) Friday
c) Sunday
d) Other day

Answer: b) Friday
MCQ ON UNCONDITIONAL CONTROL STATEMENTS: BREAK,
CONTINUE, AND GOTO

1. What does the break statement do in a loop? a) It pauses the execution of the loop.
b) It skips the current iteration and continues with the next.
c) It terminates the loop and transfers control to the statement following the loop.
d) It causes an infinite loop.

Answer: c) It terminates the loop and transfers control to the statement following the
loop.

2. What will be the output of the following code?

for (int i = 0; i < 5; i++) {


if (i == 2) {
break;
}
printf("%d ", i);
}

a) 0 1 2 3 4
b) 0 1
c) 0 1 2
d) No output

Answer: b) 0 1

3. What is the purpose of the continue statement? a) To terminate the loop immediately.
b) To skip the current iteration and move to the next iteration of the loop.
c) To exit the entire program.
d) To reset the loop counter.

Answer: b) To skip the current iteration and move to the next iteration of the loop.

4. What will be the output of the following code?

for (int i = 0; i < 5; i++) {


if (i == 2) {
continue;
}
printf("%d ", i);
}

a) 0 1 2 3 4
b) 0 1 3 4
c) 0 1 2 3
d) No output
Answer: b) 0 1 3 4

5. Which of the following statements is true regarding the goto statement? a) It can
only jump to the end of a function.
b) It can only jump to a label defined within the same block.
c) It makes code easier to read.
d) It can transfer control to any label in the program.

Answer: d) It can transfer control to any label in the program.

6. What will be the output of the following code?

int i = 0;
loop:
printf("%d ", i);
i++;
if (i < 3) goto loop;

a) 0 1 2 3
b) 0 1 2
c) 1 2 3
d) No output

Answer: b) 0 1 2

7. What happens if you use goto to jump into a block that contains variable
declarations? a) The program will crash.
b) It will work as expected.
c) The variables will not be initialized.
d) It leads to a compilation error.

Answer: c) The variables will not be initialized.

8. Which control statement is generally considered harmful and should be avoided in


structured programming? a) break
b) continue
c) goto
d) return

Answer: c) goto

9. What will be the output of the following code?

for (int i = 0; i < 5; i++) {


if (i == 1) {
continue;
}
if (i == 3) {
break;
}
printf("%d ", i);
}

a) 0 1 2 3 4
b) 0 1 2
c) 0 2
d) 0 1 2 3

Answer: c) 0 2

MCQ ON NESTED LOOPING CONTROL STATEMENTS: NESTED FOR


AND NESTED WHILE

1. What will be the output of the following code?

for (int i = 1; i <= 2; i++) {


for (int j = 1; j <= 2; j++) {
printf("%d %d\n", i, j);
}
}

a) 1 1
b) 1 1
12
21
22
c) 1 1
21
d) No output

Answer: b)

Copy code
1 1
1 2
2 1
2 2

2. What will be the output of the following code?

int i = 0;
while (i < 2) {
int j = 0;
while (j < 3) {
printf("%d %d\n", i, j);
j++;
}
i++;
}

a) 0 0
10
b) 0 0
01
02
10
11
12
c) 0 0
01
02
10
d) No output

Answer: b)

Copy code
0 0
0 1
0 2
1 0
1 1
1 2

3. What will be the output of the following code?

for (int i = 1; i <= 2; i++) {


for (int j = 1; j <= 3; j++) {
if (j == 2) break;
printf("%d %d\n", i, j);
}
}

a) 1 1
12
21
22
b) 1 1
21
c) 1 1
12
13
21
d) No output

Answer: b)

Copy code
1 1
2 1

4. How many times will the inner loop execute in the following code?

for (int i = 0; i < 3; i++) {


for (int j = 0; j < 2; j++) {
// Some code
}
}

a) 2
b) 3
c) 5
d) 6

Answer: d) 6

5. What will the following code output?

for (int i = 0; i < 2; i++) {


for (int j = 0; j < 2; j++) {
for (int k = 0; k < 2; k++) {
printf("%d %d %d\n", i, j, k);
}
}
}

a) 0 0 0
001
010
011
100
101
110
111
b) 0 0 0
001
111
c) 0 0 0
011
100
d) No output
Answer: a)

Copy code
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

6. What will be the output of this nested loop?

int count = 0;
for (int i = 1; i <= 2; i++) {
for (int j = 1; j <= 3; j++) {
count++;
}
}
printf("%d\n", count);

a) 2
b) 3
c) 5
d) 6

Answer: d) 6

7. What will be the output of the following code?

int i = 1;
while (i <= 2) {
int j = 1;
while (j <= 2) {
printf("%d %d\n", i, j);
j++;
}
i++;
}

a) 1 1
12
21
22
b) 1 1
22
c) 1 2
21
d) No output
Answer: a)

Copy code
1 1
1 2
2 1
2 2

8. How many iterations does the following nested loop execute?

int i = 0;
while (i < 5) {
for (int j = 0; j < 3; j++) {
// Some code
}
i++;
}

a) 3
b) 5
c) 8
d) 15

Answer: d) 15

9. What will be the output of the following code?

for (int i = 1; i <= 2; i++) {


for (int j = 1; j <= i; j++) {
printf("%d ", j);
}
printf("\n");
}

a) 1
12
b) 1 2
12
c) 1
12
123
d) No output

Answer: a)
MCQ ON ARRAYS, ONE-DIMENSIONAL ARRAYS, AND TWO-
DIMENSIONAL ARRAYS

1. What is the correct way to declare a one-dimensional array in C? a) int array[5];


b) int array(5);
c) array int[5];
d) int[5] array;

Answer: a) int array[5];

2. What will be the output of the following code?

int arr[3] = {1, 2, 3};


printf("%d", arr[1]);

a) 1
b) 2
c) 3
d) 0

Answer: b) 2

3. Which of the following statements is true regarding array indices in C? a) They start
from 1.
b) They start from 0.
c) They can be negative.
d) They must be declared explicitly.

Answer: b) They start from 0.

4. How do you access the first element of an array named arr? a) arr[0]
b) arr[1]
c) arr[2]
d) first(arr)

Answer: a) arr[0]

5. What is the output of the following code?

int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};


printf("%d", arr[1][2]);

a) 4
b) 5
c) 6
d) 7
Answer: c) 6

6. Which of the following correctly initializes a two-dimensional array?


7. a) int arr[2][3] = {1, 2, 3, 4, 5, 6};
b) int arr[2, 3];
c) int arr[2][3] = {{1, 2}, {3, 4}, {5, 6}};
d) int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};

Answer: d) int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};

8. How many elements are in the following array?

int arr[4][5];

a) 4
b) 5
c) 20
d) 9

Answer: c) 20

9. What is the output of the following code?

int arr[] = {10, 20, 30, 40};


printf("%d", arr[3]);

a) 10
b) 20
c) 30
d) 40

Answer: d) 40

10. What will happen if you try to access an element outside the bounds of an array? a)
The program will compile successfully.
b) It will give a runtime error.
c) It may return garbage value or cause undefined behavior.
d) It will reset the value to zero.

Answer: c) It may return garbage value or cause undefined behavior.

10. What will be the output of the following code?

int arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};


printf("%d", arr[2][0] + arr[0][2]);
a) 10
b) 12
c) 13
d) 16

Answer: c) 13

MCQ ON POINTERS AND ADDRESS-OF OPERATORS

1. What is a pointer in C? a) A variable that holds a constant value.


b) A variable that holds the address of another variable.
c) A data type that holds strings.
d) A reserved keyword in C.

Answer: b) A variable that holds the address of another variable.

2. Which operator is used to obtain the address of a variable?


3. a) *
b) &
c) @
d) #

Answer: b) &

4. What will be the output of the following code?

int x = 5;
int *p = &x;
printf("%d", *p);

a) 5
b) &x
c) p
d) Error

Answer: a) 5

5. What is the value of ptr after the following code executes?

int var = 10;


int *ptr = &var;
*ptr = 20;

a) 10
b) 20
c) &var
d) Error

Answer: b) 20

6. What will happen if you dereference a null pointer?


7. a) It will print 0.
b) It will cause a segmentation fault.
c) It will return the address of the variable.
d) It will have no effect.

Answer: b) It will cause a segmentation fault.

8. What is the output of the following code?

int a = 10;
int *ptr = &a;
printf("%p", ptr);

a) It prints the value of a.


b) It prints the address of a.
c) It prints a random number.
d) It gives a compilation error.

Answer: b) It prints the address of a.

9. Which of the following is a correct way to declare a pointer?


10. a) int *ptr;
b) ptr int*;
c) *int ptr;
d) int ptr*;

Answer: a) int *ptr;

11. What will be the output of the following code?

int a = 5;
int *ptr = &a;
printf("%d", *ptr + 10);

a) 5
b) 10
c) 15
d) 20

Answer: c) 15
12. If int *p; is declared, what does p point to initially? a) 0
b) Random memory location
c) Undefined value
d) The address of the first integer

Answer: c) Undefined value

10. What will be the output of the following code?

int a = 2;
int *p = &a;
a += 3;
printf("%d", *p);

a) 2
b) 3
c) 5
d) Error

Answer: c) 5

MCQ ON POINTER DECLARATION AND DEREFERENCING

1. Which of the following is the correct way to declare a pointer to an integer?


2. a) int *ptr;
b) ptr int*;
c) *int ptr;
d) int ptr*;

Answer: a) int *ptr;

3. What is the purpose of the dereference operator (*) in C?


4. a) To declare a pointer.
b) To obtain the address of a variable.
c) To access the value stored at the address a pointer is pointing to.
d) To perform arithmetic on pointers.

Answer: c) To access the value stored at the address a pointer is pointing to.

5. What will be the output of the following code?

int a = 10;
int *p = &a;
printf("%d", *p);
a) 10
b) &a
c) p
d) 0

Answer: a) 10

6. Given the declaration int *p;, which of the following statements correctly
initializes p to point to an integer variable x?
7. a) p = x;
b) p = &x;
c) *p = x;
d) p = *x;

Answer: b) p = &x;

8. What happens if you try to dereference a pointer that has not been initialized?
9. a) It will print 0.
b) It will cause a runtime error.
c) It may cause undefined behavior or a segmentation fault.
d) It will return the address of the variable.

Answer: c) It may cause undefined behavior or a segmentation fault.

10. What will be the output of the following code?

int a = 5;
int *p = &a;
*p = 20;
printf("%d", a);

a) 5
b) 20
c) 15
d) 0

Answer: b) 20

11. How do you access the value of a variable using a pointer?


12. a) ptr.value;
b) *ptr;
c) ptr*;
d) ptr->value;

Answer: b) *ptr;
13. What will happen if you dereference a pointer that points to an invalid memory
location? a) It will print a garbage value.
b) It will cause a compilation error.
c) It will cause a segmentation fault or crash the program.
d) It will return 0.

Answer: c) It will cause a segmentation fault or crash the program.

14. What is the output of the following code?

int x = 7;
int *p = &x;
x = *p + 1;
printf("%d", x);

a) 7
b) 8
c) 6
d) Error

Answer: b) 8

10. Which of the following correctly increments the value pointed to by a pointer ptr?
a) ptr++;
b) *ptr++;
c) (*ptr)++;
d) ptr = ptr + 1;

Answer: c) (*ptr)++;

MCQ ON VOID POINTERS AND NULL POINTERS

1. What is a void pointer in C? a) A pointer that does not point to any variable.
b) A pointer that can point to any data type.
c) A pointer that only points to integers.
d) A pointer that cannot be dereferenced.

Answer: b) A pointer that can point to any data type.

2. How do you declare a void pointer?


3. a) void *ptr;
b) ptr void*;
c) *ptr void;
d) void ptr*;
Answer: a) void *ptr;

4. What happens when you try to dereference a void pointer?


5. a) It will compile successfully.
b) It gives an error because the type is unknown.
c) It will return a null value.
d) It will print 0.

Answer: b) It gives an error because the type is unknown.

6. What is a null pointer in C?


7. a) A pointer that points to a valid memory location.
b) A pointer that does not point to any memory location.
c) A pointer that has not been initialized.
d) A pointer that points to a variable with a value of 0.

Answer: b) A pointer that does not point to any memory location.

8. What is the value of a null pointer typically represented as?


9. a) 1
b) 0
c) -1
d) Any random address

Answer: b) 0

10. How can you explicitly assign a null pointer?


11. a) ptr = 0;
b) ptr = NULL;
c) ptr = (void *)0;
d) All of the above

Answer: d) All of the above

12. What will be the output of the following code?

int *ptr = NULL;


printf("%d", ptr);

a) 0
b) NULL
c) Some random address
d) Error

Answer: a) 0
13. Which of the following statements about void pointers is false? a) They can be
assigned the address of any data type.
b) They can be dereferenced directly without casting.
c) They are often used for generic data structures.
d) They require casting before dereferencing.

Answer: b) They can be dereferenced directly without casting.

14. What will happen if you attempt to dereference a null pointer? a) It will print 0.
b) It may cause a segmentation fault or crash the program.
c) It will return a null value.
d) It will compile successfully but yield garbage value.

Answer: b) It may cause a segmentation fault or crash the program.

10. How do you convert a void pointer to a specific pointer type? a) Direct assignment
b) Casting
c) Using the sizeof operator
d) You cannot convert it

Answer: b) Casting

MCQ ON POINTER-BASED ARRAY MANIPULATION

1. How do you declare a pointer to an integer array in C?


2. a) int array*;
b) int *array;
c) int *array[];
d) int array[]*;

Answer: b) int *array;

3. What will be the output of the following code?

int arr[] = {10, 20, 30};


int *ptr = arr;
printf("%d", *(ptr + 1));
a) 10
b) 20
c) 30
d) 0

Answer: b) 20

4. Which of the following correctly accesses the third element of an array using a
pointer?
5. a) *ptr[2];
b) ptr[2];
c) *(ptr + 2);
d) Both b and c

Answer: d) Both b and c

6. What is the output of the following code?

int arr[] = {1, 2, 3, 4, 5};


int *ptr = arr;
ptr++;
printf("%d", *ptr);

a) 1
b) 2
c) 3
d) 5

Answer: b) 2

7. Given the following code, what will be the output?

int arr[] = {5, 10, 15};


int *ptr = arr;
printf("%d", *(ptr + 2) - *(ptr + 1));

a) 0
b) 5
c) 10
d) 15

Answer: b) 5

8. How do you pass an array to a function using a pointer?


a) void func(int arr[]);
b) void func(int *arr);
c) Both a and b
d) void func(int &arr);

Answer: c) Both a and b

9. What will the following code output?

int arr[3] = {1, 2, 3};


int *ptr = arr;
printf("%d %d", *(ptr++), *(++ptr));

a) 1 2
b) 1 3
c) 2 3
d) 2 1

Answer: b) 1 3

10. What will be the value of arr[1] after executing the following code?

int arr[3] = {1, 2, 3};


int *ptr = arr;
*ptr += 5;

a) 1
b) 2
c) 6
d) 5

Answer: c) 6

11. Which of the following statements is true regarding pointer arithmetic? a) Adding 1
to a pointer moves it to the next byte.
b) Adding 1 to a pointer moves it to the next element of the type it points to.
c) Subtracting a pointer from another gives the size of the type it points to.
d) Both b and c are true.

Answer: d) Both b and c are true.

10. What will the output of the following code be?

int arr[] = {10, 20, 30, 40};


int *ptr = arr;
ptr += 2;
printf("%d", *ptr);
a) 10
b) 20
c) 30
d) 40

Answer: c) 30

PART B

1. Write a program to check if a given number is positive, negative, or zero using a simple if
statement.
2. Develop a program that takes three integer inputs and prints the largest number using the
if...else statement.
3. Write a program to classify a student's grade based on the following marks:
=90: A
80-89: B
70-79: C
<70: Fail
Use else if and nested if statements.
4. Create a calculator program using switch case that performs addition, subtraction,
multiplication, or division based on user input.
5. Write a program to print the first 10 Fibonacci numbers using a for loop.
6. Create a program to reverse a given integer number using a while loop.
7. Write a program that repeatedly prompts the user for a number and calculates the sum of
all numbers entered. The loop should stop when the user enters zero. Use a do...while
loop.
8. Write a program to declare, initialize, and access a 1D array of integers. Find and print
the sum of all elements in the array.
9. Write a program to declare, initialize, and display a 2D array. Find and print the sum of
all elements in each row.
10. Write a program that uses pointers to reverse the elements of a 1D array.

PART C

1. Develop a program for a school where students' grades are calculated based on marks
entered by the user. The system should accept marks for five subjects and then compute
the average and the final grade using conditional control statements (if...else, nested if).
The grade should be displayed as:

A for average >= 90

B for 80 <= average < 90


C for 70 <= average < 80

Fail for average < 70


The program should also include input validation for marks (0-100).

2. Create a program that simulates an ATM withdrawal process. The system should prompt
the user for the account type (Savings, Current), ask for the amount to withdraw, and
ensure that the balance is sufficient before proceeding with the transaction. Use switch
case for account type selection and conditional statements for balance checking. Include
the option to cancel the transaction and return to the main menu.

3. Write a program for an online shopping cart system where a user can add up to 5 items
(represented as prices) to their cart using a 1D array. The system should allow users to
view the total amount, apply a discount based on the total (10% off if the total is above
$100), and display the final amount after applying the discount. Use loops and
conditional statements to handle cart operations and discounts.

4. Design a program that accepts two 2D matrices of size 3x3 from the user. The program
should perform matrix addition and display the resulting matrix. Additionally, provide
functionality for checking whether the matrices are equal or not. Use nested for loops and
2D arrays to implement matrix addition and comparison.

5. Write a program that dynamically allocates memory for a 1D array of integers using
pointers. The program should allow the user to input the size of the array, enter the
values, and then display the array. Implement a function to reverse the array in place
using pointer manipulation and display the reversed array.

You might also like