In recursion, the function will call itself until the base condition is not true. So, Recursion is similar to a loop and it will call itself until the base condition is not true.
Please login to submit your explanation
You can check your performance of this question after Login/Signup
Ashima wants to print a pattern which includes checking and changing a variables value iteratively She decides to use a loop/condition Which of the following options should she use such that the body of the loop/condition is executed atleast once whether the variable satisfies the entering condition or not?
Do while loop
Answer : do-while loop (C)
As we know that while-loop is an entry controlled loop and do-while loop is an exit controlled loop. So if she want's that body of the loop is executed atleast once then we can use do-while in which the condition is checked at the exit and not at the entry of the loop.
Object Oriented Programming
As we all know if-else is a decison making statement .
Differ by 80
Differ by 50
Differ by 160
Answer : (A)
Let's consider the first statement print a*b/c-d
a = 40,b = 35,c = 20, d = 10 So a*b/c - d ,so (40*35)/20 - 10 = 70-10 = 60; It will be evaluated like this according to the BODMAS Rule
1st print statement = 60
2nd print statement = 140 (According to BODMAS RULE)
SO Answer : Differ by 80
printf(“Hello World! %d\n”, x);
Hello World! x;
Hello World! followed by a junk value
Compile time error
It will generate the Compile time error as the variable x is not declared in the program and it is used to print the value.
int a =456,b,c,d=10;
Answer : (B)
int x, y;
The code will be executed 15 times, as the code has two loops which are inter-related
What will be the output of the following code:
case 5 :printf("I am 5");
case 7: printf("I am not 5");
default:printf("I am different");
i am 5
i am not 5
I am different
Answer : (D)
This program will generate an error as the break statement does not end with an semi-colon in case 5.
for n = 0 to 1
sumRow1[n] = A[n] + A[n]
Rupali writes the following code (Code B):
sumRow1 = A + A
sumRow1 = A + A
Code A will execute faster than Code B
Code B will execute faster than Code A
Code A is logically incorrect.
Code B is logically incorrect.
Answer : (B)
Code B Will execute faster as it involves no loop and runs in O(1) TIME Whereas Code A will execute in O(n) time so it will be slower as compared to Code B.
int main ()
int i = 0.7;
static float m = 0.7;
if (m == i)
printf ("We are equal");
else if (m > i)
printf ("I am greater");
printf ("I am lesser");
We are equal
I am greater
I am lesser
This code will generate an error
int i = 0.7 would be equal to 0
and float 0.7 would b equal to 0.7
if(m > i) set to be true.
So, I am greater is printed
Please login to report
Buy TCS NQT Paid Materials
Join TCS NQT Online Classes
Personalized Analytics only Availble for Logged in users
Analytics below shows your performance in various Mocks on PrepInsta
Your average Analytics for this Quiz
September 16, 2021
Login/Signup to comment