TCS NQT Programming Logic Question Paper Set 2 | TCS Placement Papers – 12

Share your love

Prepare TCS NQT Programming Logic questions through this the previous year TCS NQT placement papers, this is sample official TCS NQT questions appeared in the October 2020 and 2021 NQT exam. Generally basic Data Structure, algorithm and basic system relatad question will be asked in TCS NQT Programming Section

Here all the TCS NQT Previous Year question papers

Question 1 – What will be the output?

class Main

{

    privateint SUM;

    public static void main(String args[])

    {

        Main main = new Main();

    }

    public void Main(int a, int b)

Work From Home, Earn Part Time Upto 10K:: Register Now

    {

        a=10;

        b=10;

        SUM = a+b;

        System.out.println(SUM);

    }

}

A. Compilation error

B.0

C.20

D. No output

Answer : Option A

Explanation – the declaration of variable SUM is wrong, it should be private int SUM;

Question 2: Which one is not a type of topology ?

A. Bus Topology

B. Ring Topology

C. Circuit Topology

D. Star Topology

Answer : Option C

Question 3: Among the following loops which is a post tested loop ?

A. do-while

B. while

C. for

D. if

Answer : Option A

Question 4: When we implement stack by using linked list then :

A. Insertion of node is done from end & deletion from end

B. Insertion of node is from beginning and deletion from beginning

C. Insertion of node is done from end & deletion from beginning

D. Insertion of node is done from beginning and deletion from end

Answer : Option A

Question 5:  Assume Linked list as head 2 -> 4 -> 6 -> 8

structemp{

    int emp_id;

    structemp *next;

};

structemp *head, *next;

temp=head;

while(temp -> next != NULL)

{

    printf(“%d”,temp -> emp_id)

    temp = temp -> next;

}

What will be the output of the following program ?

A. 2460

B. 246

C. 2468

D. 246NULL

Answer : Option B (246)

Question 6 :The primary mission of an analyst or system designer is to:

A. Extract the physical requirements of the users and convert them into software

B. Development of Software evaluation tool

C. Create a data flow diagram

D. Calculate the return on investment

Answer : Option C

   

Question 7:____________ is a process to identify the key aspects of an entity and hiding the rest.

A. Polymorphism

B. Encapsulation

C. Inheritance

D. Abstraction

Answer : Option B

Question 8: _________ function is used to show key pressed by user will appear on the screen

A. gets()        

B. getche()

C. gfets()

D. getch()

Answer : Option B

Question 9: Which of the following is incorrect syntax for function declaration with default argument?

A. int foo(int x= 10, int y=20, int z=30);

B. int foo(int x, int y=20, int z =30);

C. int foo(int x, int y, int z =30);

D. int foo(int x, int y=20, int z);

Answer: Option B

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

class Test1

{

    private static int add(int a, int b)

    {

        System.out.println(“Inside private method”);

        return a+b;

    }

    protected static int add(int a, int b)

    {

        System.out.println(“Inside protected method”);

        return a+b+c;

    }

}

public class Main extends Test1

{

    static int add(int a, int b, int c)

    {

       System.out.println(“Inside static method”);

        return a+b+c;

    }

    public static void main(String[] args)

    {

        Main t = new Main();

        System.out.println(t.add(10,20,20));

    }

}

A. Inside protected method

B. Compilation error

C. Run time error

D. Inside static method

Answer: Option B

Question 11: What will be the output of the following program

public class Main

{

        public static void main(String args[])

        {

            int i = 1, j=1;

            for(;j<=i ; System.out.println(i+ “-” + j++));

        }

}

Answer: 1-1


Question 12:
 When we execute the given code what will be the value of x and y?

#include <stdio.h>

#include<conio.h>

void swap (int &x, int &y)

{

    int temp;

    temp = x;

    x=y;

    x= temp;

}

int main()

{

    int x= 10, y = 20;

    swap(x,y);

    cout<<x<<y;

    return 0;

}

Enter your answer only as a numeral

Answer: 1020

Question 13: The primary mission of an analyst or systems designer is to

A. Calculate the return on investment

B. Development of software evaluation tool

C. Create Data Flow Diagram

D. Extract the physical requirements of the users and convert them to software.

Answer: Option D

Question 14: The statement printf(“%d,25 ? 5 ? 0 : 5 : 25”); will print

A. 5

B. Compile time error

C. 0

D. 25

Answer: Option C

Question 7: What will be the value of fseek() function if error occurs?

A. Any non zero value

B. 0

C. Null

D. 1

Answer: Option A


Question 15: 
Integer m=10, n= 35, p=5, d=6. Comment about the output of the given two statements:

Print m*n + p/d

Print p/d + m*n

A. Differ by 10

B. Same

C. Differ by 20

D. Differ due to left and right precedence

Answer: Option b

Question 16: When we implement stack by using linked list then:

A. Insertion of node is done from end and deletion from end

B. Insertion of node is done from beginning and deletion from end

C. Insertion of node is done from beginning and deletion from beginning

D. Insertion of node is done from end and deletion from beginning

Answer: Option C

Join Our Telegram Channel For Daily Jobs UpdateFollow Now
WFH Jobs: Earn Upto 10K+ Per Month, By Completing Simple Task Register Here
Join Our WhatsApp Group For Daily UpdatesJoin Now
Share your love