Qus : 1
WB JECA MCA PYQ
4
Find out the wrong statement based on the characteristics of AVL tree data structure.
1
AVL tree is a binary search tree in nature.
2
AVL tree is known as height-balanced tree. 3
AVL tree has O(log₂ n) search time complexity considering ‘n’ as number of nodes. 4
AVL tree has O(n) search time complexity considering ‘n’ as number of nodes. Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution AVL trees guarantee O(log n) search time, not O(n).
Qus : 15
WB JECA MCA PYQ
1
In software engineering, a prototyping model can be used when __________.
1
Technical solutions are unclear to the development team
2
Technical solutions are clear to the development team 3
Models are unclear to the development team
4
Feasibility solutions are unclear to the development team
Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution Technical solutions are unclear to the development team
Qus : 37
WB JECA MCA PYQ
1
What is the output of the following code snippet?
#include <stdio.h>
main() {
int x = 65, *p = &x;
void *q = p;
char *r = q;
printf("%c", *r);
} (A) $A$
(B) $Z$
(C) $65$
(D) None of the above
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Step 1: Initialization
$x = 65$
In ASCII, $65 \equiv A$
Step 2: Pointer flow
$p = \&x \;\; \rightarrow$ pointer to integer
$q = p \;\; \rightarrow$ void pointer
$r = q \;\; \rightarrow$ typecast to char pointer
Step 3: Dereferencing
Since r is char*, it reads 1 byte .
The value stored = $65$
Step 4: Printing
printf("%c", *r); prints character with ASCII $65$.
Hence, the output is:
$\; \boxed{A} \;$
Correct Answer: (A)
Qus : 38
WB JECA MCA PYQ
1
ROM is a
(A) Combinational Circuit
(B) Static Circuit
(C) Sequential Circuit
(D) Magnetic Circuit
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
- ROM (Read Only Memory) stores fixed data permanently.
- Its output depends only on the given input address.
- No clock or feedback is required, so it is not sequential .
- Hence, ROM is a Combinational Circuit .
Correct Answer: (A) Combinational Circuit
Qus : 39
WB JECA MCA PYQ
1
Each stage in pipelining should be completed within _________cycles.
(A) 1
(b) 2
(C) 3
(D) 4
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
In pipelining, the CPU instruction is divided into stages (Fetch, Decode, Execute, etc.). To maximize throughput, each stage must complete within 1 clock cycle . This ensures that new instructions can enter the pipeline without delay.
Correct Answer: (A) 1
Qus : 40
WB JECA MCA PYQ
2
Relational calculus is a
(A) Procedural language
(B) Non-procedural language
(C) Data definition language
(D) High-level language
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Relational Algebra is procedural (it specifies how to obtain the result).Relational Calculus is non-procedural (it specifies what to obtain, not how).Therefore, Relational Calculus is a
Non-procedural language .
Correct Answer: (B) Non-procedural language
Qus : 42
WB JECA MCA PYQ
3
An artificially intelligent car decreases its speed based on its distance from the car in front of it. Which method is used?
(A) Naive Bayes
(B) Decision Tree
(C) Linear Regression
(D) Logistic Regression
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
The car’s speed is a continuous variable that depends on the distance from the car ahead. To model this relation, we need a method for predicting a continuous outcome. Linear Regression is used because it maps distance (input) to speed (output).
Correct Answer: (C) Linear Regression
Qus : 43
WB JECA MCA PYQ
2
The keyword friend does not appear in
(A) the class allowing access to another class.
(B) the class desiring access to another class.
(C) the private section of a class.
(D) the public section of a class.
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
The friend keyword is used inside a class definition to allow another class or function to access its private/protected members. It appears in the class granting access (not the one desiring access). It can be declared in either public or private section of that class. Hence, it
does not appear in the class desiring access .
Correct Answer: (B) the class desiring access to another class
Qus : 44
WB JECA MCA PYQ
4
What is the maximum number of level-2 DFD possible if the number of
processes in level-1 DFD is n ?
(A) $\frac{n}{2}$
(B) 2
(C) $n^2$
(D) n
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
In a Data Flow Diagram (DFD), each process in level-1 can be decomposed further into its own level-2 diagram. Therefore, if there are
n processes at level-1, then maximum possible level-2 DFDs =
n .
Correct Answer: (D) $n$
Qus : 45
WB JECA MCA PYQ
4
The small extremely fast RAM's are termed as ______
(A) Heap
(B) Accumulators
(C) Stack
(D) Cache
1
A 2
B 3
C 4
D Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Heap → Memory area for dynamic allocation.Accumulator → Register in CPU for intermediate results.Stack → Memory area used for function calls and local variables.Cache → Small, high-speed RAM located close to the CPU, used to store frequently accessed data.Hence, the correct answer is
Cache .
Correct Answer: (D) Cache
Qus : 54
WB JECA MCA PYQ
4
What is the output of the following C-program?\n#include\n#define CUBE(x) (x*x*x)\nint main() { int a, b=3; a = CUBE(b++); printf("%d, %d\n", a, b); return 0; }
1
9, 4 2
27, 4 3
27, 6 4
Error Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution:
- Macro expansion: CUBE(b++) → (b++ * b++ * b++).
- This causes multiple side effects → undefined behavior.
- Most compilers treat this as error/undefined .
Answer = (D) Error
Qus : 56
WB JECA MCA PYQ
3
What is the purpose of the confusion matrix in machine learning?
1
To visualize the distribution of the data in a dataset 2
To compare the performance of different models 3
To evaluate the performance of a classification model 4
To evaluate the performance of a regression model Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution:
- Confusion matrix is used in classification tasks .
- It compares predicted vs actual labels (TP, FP, TN, FN).
Answer = (C) To evaluate the performance of a classification model
Qus : 59
WB JECA MCA PYQ
1
Which among the following can’t be used for polymorphism?
1
Static member functions 2
Member functions overloading 3
Predefined operator overloading 4
Constructor overloading Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Static member functions cannot be virtual ; hence they don’t participate in runtime polymorphism.
Overloading (functions/operators/constructors) supports polymorphism.Answer: (A) Static member functions
Qus : 67
WB JECA MCA PYQ
3
Which of the following is an example of a classification problem?
1
Predicting the price of a house based on its features 2
Predicting the weight of a person based on their height 3
Predicting whether a customer will churn or not 4
Predicting the age of a person based on their income Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Classification predicts categories . Customer churn = Yes/No ⇒ classification.
Answer: (C) Predicting whether a customer will churn or not
Qus : 69
WB JECA MCA PYQ
1
What is the difference between supervised and unsupervised learning?
1
Supervised learning requires labelled data while unsupervised learning does not. 2
Unsupervised learning requires labelled data while supervised learning does not. 3
Supervised learning does not require data while unsupervised learning does. 4
There is no difference between supervised and unsupervised learning. Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Supervised = labelled data, Unsupervised = unlabelled data.
Answer: (A) Supervised learning requires labelled data while unsupervised learning does not.
Qus : 77
WB JECA MCA PYQ
2
Given an unsorted array where each element is at most k distance from its position in a sorted array. Which sorting algorithm can be easily modified for this and what is its time complexity?
1
Insertion Sort with O(kn) 2
Heap Sort with O(n log k) 3
Quick Sort with O(k log k) 4
Merge Sort with O(k log k) Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: A k-sorted array can be efficiently sorted using a min-heap of size k, yielding O(n log k) time.
Answer: (B) Heap Sort with O(n log k)
Qus : 80
WB JECA MCA PYQ
2
A process is thrashing if ____.
1
it spends more time in execution, rather than paging 2
it spends more time in paging, rather than in execution 3
it has no memory allocated to it 4
it indefinitely waits for a resource Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Thrashing occurs when the CPU spends most of its time handling page faults rather than executing instructions.
Answer: (B) it spends more time in paging, rather than in execution
Qus : 83
WB JECA MCA PYQ
1
In a relational database, what does the term "ACID" stand for?
1
Atomicity, Consistency, Integrity, Durability 2
Association, Constraint, Index, Database 3
Authorization, Compatibility, Isolation, Dependency 4
Aggregate, Collection, Inheritance, Design Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: ACID properties are Atomicity, Consistency, Isolation, Durability. Option (A) is closest (Integrity ~ Isolation).
Answer: (A) Atomicity, Consistency, Integrity, Durability
Qus : 84
WB JECA MCA PYQ
3
Which of the given statement is the correct recurrence for the worst case of Binary Search?
1
T(n) = 2T(n/2) + O(1) & T(1)=O(1)=T(0) 2
T(n) = T(n-1) + O(1) & T(1)=O(1)=T(0) 3
T(n) = T(n/2) + O(1) & T(1)=T(0)=O(1) 4
T(n) = T(n-2) + O(1) & T(1)=O(1) Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Binary search recurrence is T(n) = T(n/2) + O(1) . Base case T(1)=O(1).
Answer: (C) T(n) = T(n/2) + O(1)
Qus : 85
WB JECA MCA PYQ
2
Which of the following statements about primary key in a database table is true?
1
A table can have multiple primary keys. 2
A primary key uniquely identifies each record in a table. 3
Primary keys can contain NULL values. 4
Primary keys are used to establish relationships between tables. Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: A table can have only one primary key, it cannot contain NULLs. Its main property: uniquely identifies each record .
Answer: (B) A primary key uniquely identifies each record in a table
Qus : 87
WB JECA MCA PYQ
4
Which is the correct statement about operator overloading ?
1
Only arithmetic operators can be overloaded. 2
Only non-arithmetic operators can be overloaded. 3
Precedence of operators are changed after overloading. 4
Associativity and precedence of operators does not change. Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Overloading changes operator meaning for user types, but its precedence and associativity never change .
Answer: (D)
Qus : 88
WB JECA MCA PYQ
3
Numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The tree uses usual ordering. What is the in-order traversal sequence?
1
7, 5, 1, 0, 3, 2, 4, 6, 8, 9 2
0, 2, 4, 3, 1, 6, 5, 9, 8, 7 3
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 4
9, 8, 6, 4, 2, 3, 0, 1, 5, 7 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: In-order traversal of a BST gives the sorted order of keys ⇒ 0 to 9 ascending.
Answer: (C) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Qus : 90
WB JECA MCA PYQ
2
Which of the following statement is correct ?
1
Pre-order traversal of Binary search gives sorted list. 2
In-order traversal of Binary search tree gives sorted list. 3
Post-order traversal of Binary search tree gives sorted list. 4
None of the above. Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: For a BST, only in-order traversal yields the keys in sorted order.
Answer: (B)
Qus : 94
WB JECA MCA PYQ
1
When several processes access the same data concurrently and the outcome depends on the particular order in which the access takes place is called ________.
1
Race condition 2
Critical condition 3
Virtual condition 4
Linear condition Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2024 PYQ
Solution
Solution: Order-dependent outcomes from concurrent access is a classic race condition .
Answer: (A) Race condition
Qus : 116
WB JECA MCA PYQ
3
What is the output of the following C program?
#include <stdio.h>
void main(){
int a = -7;
float b;
b = a++;
printf("%d, %f ", a, ++b);
} 1
-6, -7.000000 2
-5, -6 3
-6, -6.000000 4
-6, -6 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: The statement b = a++; assigns the current value of a (−7) to b and then increments a to −6.
Later, ++b increments b from −7 to −6 before printing.
$$ a = -6,\quad b = -6.000000 $$
Qus : 117
WB JECA MCA PYQ
4
What is the output?
#include <stdio.h>
void main(){
int i = -1;
printf("sizeof(i) = %d", sizeof(i));
} 1
Compiler Error 2
sizeof(i) = -1 3
sizeof(i) = 1 4
sizeof(i) = 4 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: The operator sizeof gives the size of the type in bytes, not the value.
On most 32-bit and 64-bit systems, sizeof(int) is 4.
$$ \text{Output: } \texttt{sizeof(i) = 4} $$
Qus : 118
WB JECA MCA PYQ
3
What is the output?
#include <stdio.h>
void main(){
int x = -1, y = 1, z = 0;
if(x && y++ && z)
++x, y++, --z;
printf("%d, %d, %d", x++, y++, z++);
} 1
0, 3, 0 2
Compiler Error 3
-1, 2, 0 4
1..0 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: In the condition x && y++ && z, since z = 0, the logical AND short-circuits and the body of the if is not executed.
However, y++ is evaluated before the short-circuit, so y becomes 2.
Values before printing:
$$ x = -1,\ y = 2,\ z = 0 $$
So the program prints:
$$ (-1,\ 2,\ 0) $$
Qus : 119
WB JECA MCA PYQ
1
What is the output?
#include <stdio.h>
enum colors{RED, BROWN, ORANGE};
void main(){
printf("%ld..%f..%d", RED, BROWN, ORANGE);
} 1
Compiler Error 2
0..0.000000..1 3
0..1.000000..2 4
Runtime Error Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: The format specifiers do not match the data types (%f is used for int).
This causes undefined behavior .
The program may compile, but the output is not reliable.
Correct choice: None of these .
Qus : 122
WB JECA MCA PYQ
3
What is the output?
#include <stdio.h>
void main(){
int **ptr;
int temp = 65;
ptr[0] = &temp;
printf("%d", ptr[0][0]);
} 1
Compiler error 2
65 3
Segmentation Fault 4
Runtime Error Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: The pointer ptr is uninitialized, so it does not point to valid memory.
When the code tries to access ptr[0], it attempts to dereference an invalid location.
This leads to undefined behavior, and in most cases results in a segmentation fault .
Qus : 123
WB JECA MCA PYQ
2
What is the output?
#include <stdio.h>
#include <stdlib.h>
void main(){
int *ptr;
ptr = (int*) calloc(3, sizeof(int));
ptr[2] = 30;
printf("%d", *ptr);
free(ptr);
} 1
30 2
0 3
calloc 4
Error Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: The function calloc initializes all allocated memory blocks with zero.
So ptr[0] is initialized to 0 .
The statement *ptr is equivalent to ptr[0].
$$ \text{Output: } 0 $$
Qus : 127
WB JECA MCA PYQ
1
13. BIOS means ______________.
(A) basic input/output system (B) best input/output system (C) basic input system (D) basic output system
1
basic input/output system 2
best input/output system 3
basic input system 4
basic output system Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: BIOS stands for Basic Input/Output System , firmware that initializes hardware and starts the boot process.
Qus : 129
WB JECA MCA PYQ
2
15. If only one process can be able to access a particular resource at a time, then it is known as ______________.
(A) Mutual execution (B) Mutual exclusion (C) Multiple execution (D) Multiple exclusion
1
Mutual execution 2
Mutual exclusion 3
Multiple execution 4
Multiple exclusion Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: Allowing only one process to access a resource at a time is called mutual exclusion (mutex).
Qus : 131
WB JECA MCA PYQ
4
17. Banker’s algorithm for resource allocation deals with ______________.
(A) mutual exclusion (B) mutual inclusion (C) deadlock recovery (D) deadlock avoidance
1
mutual exclusion 2
mutual inclusion 3
deadlock recovery 4
deadlock avoidance Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: Banker’s algorithm is a deadlock avoidance algorithm ensuring the system stays in a safe state.
Qus : 132
WB JECA MCA PYQ
2
18. Page fault means ______________.
(A) required page is available in main memory (B) required page is not available in main memory (C) segment number (D) reduce page I/O
1
required page is available in main memory 2
required page is not available in main memory 3
segment number 4
reduce page I/O Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: A page fault occurs when the referenced page is not present in main memory, forcing a page-in from secondary storage.
Qus : 134
WB JECA MCA PYQ
3
20. Demand paging is considered as ______________.
(A) fetching a page when not needed (B) switching between two processes (C) fetching a page only when needed (D) switching between two threads
1
fetching a page when not needed 2
switching between two processes 3
fetching a page only when needed 4
switching between two threads Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: In demand paging , a page is loaded into memory only when it is actually referenced.
Qus : 135
WB JECA MCA PYQ
4
21. Thrashing means a condition having ______________.
(A) minimum paging (B) optimized paging (C) synchronized paging (D) excessive paging
1
minimum paging 2
optimized paging 3
synchronized paging 4
excessive paging Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: Thrashing occurs when the system spends most time paging due to insufficient frames, causing excessive paging and poor performance.
Qus : 136
WB JECA MCA PYQ
2
22. A counting semaphore is initialized to 15. Then, 4 wait operations and 2 signal operations are completed on this semaphore. The resulting value of the semaphore is ____________.
(A) 11 (B) 13 (C) 17 (D) 19
1
11 2
13 3
17 4
19 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: Each wait (P) decrements; each signal (V) increments.
Initial: 15 → after 4 waits: 11 → after 2 signals: 13.
$$ 15 - 4 + 2 = 13 $$
Qus : 138
WB JECA MCA PYQ
4
24. In file management, FAT means ______________.
(A) Feature Access Table (B) File Access Table (C) Fault Allocation Table (D) File Allocation Table
1
Feature Access Table 2
File Access Table 3
Fault Allocation Table 4
File Allocation Table Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution
Explanation: FAT stands for File Allocation Table , a file system layout used to map files to disk clusters.
Qus : 139
WB JECA MCA PYQ
1
25.What is the output of the following program ? include <iostream> using namespace std; int addition (int a, int b) { return a+b; } double addition (double a, double b) { return a+b; } int main () { cout<< addition (35,20) << “;”; cout<< addition (34.1,12.7); return 0; }
1
55;46.8 2
Compile Error 3
Runtime Error 4
Segmentation Fault Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution The given program defines two overloaded functions `addition`:
1. `int addition(int a, int b)` → returns integer sum
2. `double addition(double a, double b)` → returns double sum
In `main()`:
- `addition(35,20)` calls the integer version → 35 + 20 = 55
- `addition(34.1,12.7)` calls the double version → 34.1 + 12.7 = 46.8
Therefore, the output is:
55;46.8
Qus : 140
WB JECA MCA PYQ
1
26.What is the output of the following program ? #include <iostream> using namespace std; template <class C1, class C2> bool is_equal (C1 var1, C2 var2) { return (var1 = = var2); } int main () { if (is_equal(10,10.0)) cout<< “Equal”; else cout<< “Not equal”; return 0; }
1
Equal 2
Not equal 3
Compile Error 4
Runtime Error Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution The function `is_equal` is a template that compares two variables of possibly different types.
In `main()`, we call `is_equal(10, 10.0)`.
- `10` is an integer (int).
- `10.0` is a double.
C++ allows implicit type conversion during comparison.
So, `10 == 10.0` evaluates to `true`.
Therefore, the condition in the `if` statement is true, and the output will be:
Equal
Qus : 141
WB JECA MCA PYQ
1
26.What is the output of the following program ?
#include <iostream>
using namespace std;
int main()
{
int var = 0;
while (var < 10)
{
cout << var << " ";
var++;
}
cout << var;
return 0;
}
1
0 1 2 3 4 5 6 7 8 9 10 2
0 1 2 3 4 5 6 7 8 9 3
1 2 3 4 5 6 7 8 9 10 4
1 2 3 4 5 6 7 8 9 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution Output:
0 1 2 3 4 5 6 7 8 9 10
Explanation:
The variable var starts at 0.
The while (var < 10) loop prints 0 1 2 3 4 5 6 7 8 9 with spaces.
When var reaches 10, the loop stops.
After the loop, cout << var; prints 10.
Final output:
Qus : 142
WB JECA MCA PYQ
1
What is the output of the following program ?
#include <iostream>
using namespace std;
struct demo
{
int var;
};
int main()
{
demo str;
demo *ptr;
str.var = 100;
ptr = &str;
cout << ptr->var;
return 0;
}
1
100 2
Memory address of var 3
Compile Error 4
L-value Error Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution Output:
100
Explanation:
str.var = 100; assigns 100 to the structure variable.
ptr = &str; makes the pointer point to str.
ptr->var accesses the member var of structure str via pointer.
Hence it prints 100.
Qus : 143
WB JECA MCA PYQ
1
29.What is the output of the following program ?
#include <iostream>
using namespace std;
int main ()
{
int c1 = 10;
int c2 = 20;
{
int c1;
c1 = 50;
c2 = 50;
cout << "c1= " << c1 << ", c2=" << c2;
}
cout << ", c1= " << c1 << ", c2=" << c2;
return 0;
}
1
c1= 50, c2= 50; c1= 10, c2= 50 2
c1= 10, c2= 20; c1= 10, c2= 20 3
c1= 50, c2= 50; c1= 10, c2= 20 4
c1= 10, c2= 20; c1= 10, c2= 50 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution Output:
c1= 50, c2=50, c1= 10, c2=50
Explanation:
Outer c1 = 10, c2 = 20.
Inside the inner block, a new local c1 is declared (shadowing outer c1).
Inner c1 = 50, and c2 (outer one) is updated to 50.
First cout prints → c1= 50, c2=50.
After the block ends, inner c1 is destroyed. Outer c1 remains 10, while outer c2 is 50.
Second cout prints → , c1= 10, c2=50.
? Final output: c1= 50, c2=50, c1= 10, c2=50.
Qus : 146
WB JECA MCA PYQ
2
32.What is the output of the following program ?
#include <iostream>
using namespace std;
int main()
{
int var = 2;
do
{
cout << var;
} while (var--);
return 0;
}
1
21 2
210 3
2 4
1 Go to Discussion
WB JECA MCA Previous Year PYQ
WB JECA MCA JECA MCA 2023 PYQ
Solution Explanation:
Initially var = 2.
First iteration: prints 2, then var-- makes var = 1.
Second iteration: prints 1, then var-- makes var = 0.
Third iteration: prints 0, then var-- makes var = -1. Condition fails and loop exits.
So output is:
[{"qus_id":"12632","year":"2024"},{"qus_id":"12633","year":"2024"},{"qus_id":"12634","year":"2024"},{"qus_id":"12635","year":"2024"},{"qus_id":"12636","year":"2024"},{"qus_id":"12638","year":"2024"},{"qus_id":"12639","year":"2024"},{"qus_id":"12640","year":"2024"},{"qus_id":"12641","year":"2024"},{"qus_id":"12642","year":"2024"},{"qus_id":"12643","year":"2024"},{"qus_id":"12644","year":"2024"},{"qus_id":"12645","year":"2024"},{"qus_id":"12646","year":"2024"},{"qus_id":"12647","year":"2024"},{"qus_id":"12648","year":"2024"},{"qus_id":"12649","year":"2024"},{"qus_id":"12650","year":"2024"},{"qus_id":"12651","year":"2024"},{"qus_id":"12652","year":"2024"},{"qus_id":"12653","year":"2024"},{"qus_id":"12654","year":"2024"},{"qus_id":"12655","year":"2024"},{"qus_id":"12656","year":"2024"},{"qus_id":"12657","year":"2024"},{"qus_id":"12658","year":"2024"},{"qus_id":"12659","year":"2024"},{"qus_id":"12660","year":"2024"},{"qus_id":"12661","year":"2024"},{"qus_id":"12662","year":"2024"},{"qus_id":"12663","year":"2024"},{"qus_id":"12664","year":"2024"},{"qus_id":"12666","year":"2024"},{"qus_id":"12667","year":"2024"},{"qus_id":"12668","year":"2024"},{"qus_id":"12669","year":"2024"},{"qus_id":"12670","year":"2024"},{"qus_id":"12671","year":"2024"},{"qus_id":"12672","year":"2024"},{"qus_id":"12673","year":"2024"},{"qus_id":"12674","year":"2024"},{"qus_id":"12675","year":"2024"},{"qus_id":"12676","year":"2024"},{"qus_id":"12677","year":"2024"},{"qus_id":"12678","year":"2024"},{"qus_id":"12679","year":"2024"},{"qus_id":"12680","year":"2024"},{"qus_id":"12681","year":"2024"},{"qus_id":"12682","year":"2024"},{"qus_id":"12683","year":"2024"},{"qus_id":"12685","year":"2024"},{"qus_id":"12685","year":"2024"},{"qus_id":"12686","year":"2024"},{"qus_id":"12687","year":"2024"},{"qus_id":"12688","year":"2024"},{"qus_id":"12689","year":"2024"},{"qus_id":"12690","year":"2024"},{"qus_id":"12691","year":"2024"},{"qus_id":"12692","year":"2024"},{"qus_id":"12693","year":"2024"},{"qus_id":"12694","year":"2024"},{"qus_id":"12695","year":"2024"},{"qus_id":"12696","year":"2024"},{"qus_id":"12697","year":"2024"},{"qus_id":"12698","year":"2024"},{"qus_id":"12699","year":"2024"},{"qus_id":"12700","year":"2024"},{"qus_id":"12701","year":"2024"},{"qus_id":"12702","year":"2024"},{"qus_id":"12703","year":"2024"},{"qus_id":"12704","year":"2024"},{"qus_id":"12705","year":"2024"},{"qus_id":"12706","year":"2024"},{"qus_id":"12707","year":"2024"},{"qus_id":"12708","year":"2024"},{"qus_id":"12709","year":"2024"},{"qus_id":"12710","year":"2024"},{"qus_id":"12711","year":"2024"},{"qus_id":"12637","year":"2024"},{"qus_id":"12756","year":"2023"},{"qus_id":"12757","year":"2023"},{"qus_id":"12758","year":"2023"},{"qus_id":"12759","year":"2023"},{"qus_id":"12760","year":"2023"},{"qus_id":"12761","year":"2023"},{"qus_id":"12762","year":"2023"},{"qus_id":"12763","year":"2023"},{"qus_id":"12764","year":"2023"},{"qus_id":"12765","year":"2023"},{"qus_id":"12766","year":"2023"},{"qus_id":"12767","year":"2023"},{"qus_id":"12768","year":"2023"},{"qus_id":"12769","year":"2023"},{"qus_id":"12770","year":"2023"},{"qus_id":"12771","year":"2023"},{"qus_id":"12772","year":"2023"},{"qus_id":"12773","year":"2023"},{"qus_id":"12774","year":"2023"},{"qus_id":"12775","year":"2023"},{"qus_id":"12776","year":"2023"},{"qus_id":"12777","year":"2023"},{"qus_id":"12778","year":"2023"},{"qus_id":"12779","year":"2023"},{"qus_id":"12780","year":"2023"},{"qus_id":"12781","year":"2023"},{"qus_id":"12782","year":"2023"},{"qus_id":"12783","year":"2023"},{"qus_id":"12784","year":"2023"},{"qus_id":"12785","year":"2023"},{"qus_id":"12786","year":"2023"},{"qus_id":"12787","year":"2023"},{"qus_id":"12788","year":"2023"},{"qus_id":"12789","year":"2023"},{"qus_id":"12790","year":"2023"},{"qus_id":"12791","year":"2023"},{"qus_id":"12792","year":"2023"},{"qus_id":"12793","year":"2023"},{"qus_id":"12794","year":"2023"},{"qus_id":"12795","year":"2023"},{"qus_id":"12796","year":"2023"},{"qus_id":"12797","year":"2023"},{"qus_id":"12798","year":"2023"},{"qus_id":"12799","year":"2023"},{"qus_id":"12800","year":"2023"},{"qus_id":"12801","year":"2023"},{"qus_id":"12802","year":"2023"},{"qus_id":"12803","year":"2023"},{"qus_id":"12804","year":"2023"},{"qus_id":"12805","year":"2023"},{"qus_id":"12806","year":"2023"},{"qus_id":"12807","year":"2023"},{"qus_id":"12808","year":"2023"},{"qus_id":"12809","year":"2023"},{"qus_id":"12810","year":"2023"},{"qus_id":"12811","year":"2023"},{"qus_id":"12812","year":"2023"},{"qus_id":"12813","year":"2023"},{"qus_id":"12814","year":"2023"},{"qus_id":"12815","year":"2023"},{"qus_id":"12816","year":"2023"},{"qus_id":"12817","year":"2023"},{"qus_id":"12818","year":"2023"},{"qus_id":"12819","year":"2023"},{"qus_id":"12821","year":"2023"},{"qus_id":"12822","year":"2023"},{"qus_id":"12823","year":"2023"},{"qus_id":"12824","year":"2023"},{"qus_id":"12825","year":"2023"},{"qus_id":"12826","year":"2023"},{"qus_id":"12827","year":"2023"},{"qus_id":"12828","year":"2023"},{"qus_id":"12829","year":"2023"},{"qus_id":"12830","year":"2023"},{"qus_id":"12820","year":"2023"},{"qus_id":"12831","year":"2023"},{"qus_id":"12832","year":"2023"},{"qus_id":"12833","year":"2023"},{"qus_id":"12834","year":"2023"},{"qus_id":"12835","year":"2023"}]