wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Sasi-FN-04.05.2024

Total questions: 15

Worksheet time: 30mins

Name
Class
Date
1.
In below program, what would you put in place of “?” to print “Quiz”? #include <stdio.h> int main() { char arr[] = "CCCSRMQuiz"; printf("%s", ?); return 0; }
a)
arr
b)
arr+3
c)
arr+6
d)
not possible
2.
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
a)
AB+ CD*E - FG /**
b)
AB + CD* E - F **G /
c)
AB + CD* E - *F *G /
d)
AB + CDE * - * F *G /
3.
The postfix form of A*B+C/D is?
a)
*AB/CD+
b)
AB*CD/+
c)
A*BC+/D
d)
ABCD+/*
4.
The prefix form of A-B/ (C * D ⋀ E) is?
a)
-/*⋀ACBDE
b)
-ABCD*⋀DE
c)
-A/B*C⋀DE
d)
-A/BC*⋀DE
5.
The prefix form of an infix expression p + q - r * t is?
a)
+ pq - *rt
b)
- +pqr * t
c)
- +pq * rt
d)
- + * pqrt
6.
The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?
a)
600
b)
350
c)
650
d)
588
7.
Convert the following infix expressions into its equivalent postfix expressions (A + B ⋀D)/(E - F)+G
a)
(A B D ⋀ + E F - / G +)
b)
(A B D +⋀ E F - / G +)
c)
(A B D ⋀ + E F/- G +)
d)
None
8.
Convert the following Infix expression to Postfix form using a stack x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.
a)
xyz*+pq*r+s*+
b)
xyz*+pq*r+s+*
c)
xyz+*pq*r+s*+
d)
none
9.
Consider Stack is implemented using the array. #define MAX 10 struct STACK { int arr[MAX] int top = ___________; } What will be the initial value with which top is initialized.
a)
Garbage
b)
1
c)
-1
d)
0
10.
Assume that the operators +,-, X are left associative and ⋀ is right associative. The order of precedence (from highest to lowest) is ⋀, X, +, -. The postfix expression corresponding to the infix expression a + b X c – d ⋀ e ⋀ f is
a)
abc X+ def ⋀ ⋀ -
b)
abc X+ de⋀f⋀ -
c)
ab+c Xd – e ⋀f⋀
d)
-+aXbc⋀ ⋀def
11.
If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?
a)
ABCD
b)
DCBA
c)
DCAB
d)
ABDC
12.
Consider the usual implementation of parentheses balancing program using stack. What is the maximum number of parentheses that will appear on stack at any instance of time during the analysis of ( ( ) ( ( ) ) ( ( ) ) )?
a)
1
b)
2
c)
3
d)
4
13.
Postfix Form of A+(B*C)
a)
ABC+*
b)
AB*C+
c)
ABC*+
d)
AB+C*
14.
7 5 2 + * 4 1 1 + / - is evaluated as-
a)
47
b)
24
c)
48
d)
35
15.
Result of the prefix expression * - + 4 3 5 / + 2 4 3 is
a)
1
b)
2
c)
4
d)
8