TCS NQT Programming Logic Questions & Answers Set -1 | TCS Placement Papers -4

TCS NQT Programming Logic Questions & Answers Set -1: Here the latest TCS NQT programming logic questions with answers. These are the questions of TCS NQT October 2020. Prepare for TCS NQT programming questions with this previous year TCS NQT Placement papers.

TCS NQT Programming Logic questions consist of following topics such as Fundamentals of Programming in C, C++ and Java as well some basic questions from OOPS, Data Structure & Algorithms, STL, Recursion, Threads etc.

Here the latest previous year TCS NQT Programming Logic questions with solutions.

TCS NQT Programming Logic Questions Set -1

Question 1: There are two integer numbers X and Y, and the value of X and Y is in between 0 to 25. User stores the value under a 5 bit number. How many minimum bit is required to store the result of the below expression?
Res = 3*(X-Y)

  1. 7
  2. 5
  3. 8
  4. 6

Answer: Option 3

Question 2: Which of the following options best suits for ‘Memory Leak Occurred’

  1. Resource allocation pending while debugging the code
  2. Program releases resources allocated in the memory
  3. Program does not free the memory which is allocated dynamically
  4. Occurs due to address assignment failure.

Answer: Option 3 Program does not free the memory which is allocated dynamically.

Question 3: What will be the output

public class Main {

public static void main(String[] args)

{

 int $ = 5;

}

}

  1. Nothing will print
  2. Symbol not found Error.
  3. Runtime Error
  4. Compile time error

Answer: Option 1 Nothing will print

Question 4: What will be printed when the above sample code is executed.

Enter your answer ONLY as a NUMERAL, in the box.

class Main

{  

      public static void main(String args[])

      {

          int i,j,x=0;

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

                for (j=0;j<5;j++){

                        x=(i+j-1);

                         System.out.print(x);

                          break;

                        }

             System.out.print(x);

        }

  }

Answer: 101233

Question 5: What among the following is a server based paradigm

  1. Request for Information(RFI)
  2. Data Validation Routine
  3. Cloud computing
  4. Total cost of Ownership.

AnswerOption 3 Cloud Computing

Question 6: When we declare constant pointer to integer, we CANNOT change:

  1. Value pointed by pointer
  2. Either addressing pointer variable or value at that address
  3. Changes are not permitted
  4. Address in pointer variable.

Answer: option 4 (Address in the pointer variable.)

Question 7: Which argument is passed to fflush()?

A.no parameters
B.stdin
C.stdout
D.stderr

Answer: Option B

Question 8: What will be the output for the below? Enter your answer only as Numeral

public Class Main
{
public static void main(string[])
{
int x=1/2;
if(x==0.5)
System.out.println(x+1);
else
System.out.println(x*2);
}
}

Answer: 0

Question 9: What is the name of the method that examines a particular data entity and determines what data elements need to be associated?

A. Entity relationship diagram
B. Logic Data modeling
C. Customer Entities
D. Functional Primitive

Answer: Option A

Question 10: What will be the output of the below code?

public class Main
{
static int num=30;
static class inner
{
void msg()
{
System.out.Println(‘Num: num++);}
}
public static void main(string args[])
{
Main.Inner tw=new Main.Inner();
tw.msg()
}
}

Answer: 30

Question 11: Select the correct code for opening a file for writing in binary mode

A. Filef =fwriteb(“abc.bin”)
B. Filef = fopen(“abc.bin”,”bw”)
C. Filef = fopen(“abc.bin”,”wb”)
D. Filef =fwrite(“abc.bin”,”b”)

Answer: Option C

Question 12: What will be the output of the below code?

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
class MainClass {
public void sort() {
ArrayList arrayList= new ArrayList();
arrayList.add(“mango”);
arrayList.add(“grapes”);
Iterator iterator = arrayList.iterator();
while(iterator.hasNext()) {
System.out.print(iterator.next() +” “);
}
Collections.sort(arrayList);
}
}
public class Main {
public static void main(String[] args) {
MainClass mainclass = new MainClass();
mainclass.sort();
}
}

A. mango grapes
B. Compilation error
C. Collection.sort() throws Concurrent Modification Exception
D. Grapes mango

More Jobs By Categories...
2021 BatchOff CampusMechanical
2022 BatchInternshipsCivil
2020 BatchGovt JobsElectrical
2019 BatchCS/IT/MCABCA/BSC
2018 BatchECE/ENTCMBA

Answer: Option A

Question 13: What is the name of the method that examines a particular data entity and determines what data elements need to be associated with it?

A. Customer Entities
B. Entity Relationship Diagram
C. Logic Data Modelling
D. Functional Primitive

Answer: Option B

Question 14: We cannot overload __ operator.

A. : :
B. []
C. ()
D. +

Answer: Option A

Question 15: Which of the following functions is used to accept strings with white spaces?

A.getWhiteSpaceString();
B.scanf();
C.gets();
D.getstrings();

Answer: Option C

Question 16: Which data structure is used to convert expression from one form to another form?

A. Graph
B. Stack
C. LinkedList
D. Queue

Answer: Option B

Question 17: What is the mathematical function used to round off 6.23 to 7?

A. floor(6.23)
B. ceil(6.23,7)
C. floor(6.23,7)
D. ceil(6.23)

Answer: Option D

Question 18: Which combination of the integer variables a, b and c makes the variable m get the value 4 in the following expression?

m = (a > b) ? (( a > c ) ? a : c) : ((b > c ) ? b : c )

A. a=6, b=3, c=5
B. a=6, b=5, c=3
C. a=5, b=4, c=5
D. a=3, b=4, c=2

Answer: Option D

Question 19: Which of the following options best suits for ‘Memory Leak Occurred’

A. Resource allocation pending while debugging the code
B. Program releases resources allocated in the memory
C. Program does not free the memory which is allocated dynamically
D. Occurs due to address assignment failure.

Answer- Option C

Question 20: Given here is a scenario. Consider the graph algorithm and answer the given question.

John wants to go to different locations of the city in which he is. He has listed all of them down. However he wants to visit one location before visiting some other location. What application of graphs can he use to determine that location?  

  1. DFS
  2. Dijsktra’s
  3. BFS
  4. Topological Sorting

Answer: Option 2 (Dijkstra’s)

Question 21: Find Prefix and Postfix for the below Infix problem statement:

A. Prefix Expression: 11 20 5 20 15 – 6 5  ^^ * / +

Postfix Expression: + 11 / 20 * 5 ^^ – 20 15 6 5

B. Prefix Expression: + 11 / 20 * 5 ^^ – 20 15 6 5

Postfix Expression: 11 20 5 20 15 – 6 5 ^^ * / +

C. Prefix Expression: 11 20 15 20 5 – ^^ * 6 5 / +

Postfix Expression: + 20 / 11 * 5 – 20 ^^ 15 6 5

D. Prefix Expression: 11 20 5 20 15 – ^^ * / + 6 5

Postfix Expression: + 11 / ^^ – 20 * 5 20 15 6 5

Answer: Option D

Keep updated on our telegram channel, we will updates all TCS NQT programming questions on the section.

Join Our Telegram Channel For Daily Jobs UpdateJoin Now
WFH Jobs: Earn Upto 10K+ Per Month, By Completing Simple Task Click Here
Join Our WhatsApp Group For Daily UpdatesJoin Now
Previous articleHike Off Campus Recruitment Drive 2021 | Freshers | BE/B.Tech | Work From Home
Next articlePersistent Off Campus Drive 2021 | BE/B.Tech | Freshers | Woman Only | 2019 & 2020 Batch