
Programming Logic
Integer digit = 0;
if digit
print “1”
else
print “digit”
end if
Question 1
Answer
Question 1
What will be the output of the above program?
A. 1
B. 0
C. digit
D. Nothing will print
Answer
C. digit
#include
void f(int*p, int*m)
{*m=*m+3;
*p=*p+*m;
return;
}
int main ()
{
int k=0;
f(&i,&j);
k=(i*j);
printf(“%d”, k);
return 0;
}
Question 2
Answer
Question 2
What will be the output of the above program?
A. 134
B. 126
C. 125
D. 138
Answer
B. 126
TCS NQT MOCK TEST / PRACTICE AET
Click Here!
Question 3
Answer
Question 3
Below is the JSON format to share the employee data.
{
“id”: “001”,
“Name’: “John”
“Department”: “QA”
A JSON format, designed with a collection of (key, value) and pairs in which each of the key appears at once in the collection.
Which type of data structures is most suitable to implement JSON format?
A. Doubly Linked List
B. AVL Tree
C. Single Linked List
D. Associative Array
Answer
B. AVL Tree
#include
Void main ()
{
Int rate = 15, piece = 10, interim, result = 0;
interim = rate % piece;
result + = interim / 5
printf(“%d, result);
}
Question 4
Answer
Question 4
What will be the output of the above program?
A. 10
B. 2
C. 5
D. 1
Answer
D. 1
using namespace std;
int main()
{
int a = 3, b = 5;
while(b--)
a++;
cout << a;
return 0;
}
Question 5
Answer
Question 5
What will be the output of the above program?
Answer
Answer: 8
#include
using namespace std;
int main ()
{
Int sides = 3;
Int lines = 3;
If (!(sides^lines)}
cout<< “Triangle”;
else
cout<<”Others”;
return 0;
}
Question 6
Answer
Question 6
What will be the output of the above program?
Answer
Triangle
Question 7
Answer
Question 7
Evaluation of cyclomatic complexity comes under which type of testing?
A. Black Testing
B. White Testing
C. Stress Testing
D. Gray Testing
Answer
B. White Testing
#include
using namespace std;
int main ()
{
Int skip_num;
for (skip_num = 1; skip_num<=5; skip_num++){
if(skip_num = =2 || skip_num = =4){
continue;
}
cout<<skip_num;
cout<<’’
}
return 0;
}
Question 8
Answer
Question 8
What will be the output of the above program?
A. 1 3 5
B. 1 3 4 5
C. 1 2 5
D. 2 4 6
Answer
A. 1 3 5
Question 9
Answer
Question 9
What is the output of the prefix expression +, -, *, 7, 2, /, 9, 3, 1?
A. 13
B. 10
C. 11
D. 12
Answer
D. 12
Also Checkout