Join Regular Classroom : Visit ClassroomTech

TCS NQT Previous Year Solve | Day 2 | Slot 1 (IV) | Codewindow.in

TCS NQT

Programming Logic

When we compose a binary tree through the given preorder sequence, what will be left child of 6? (Note: Consider 4 as root node)
4, 2, 1, 3, 6, 5, 7
A. 1
B. 5
C. 7
D. 3

Based on below infix and postfix expressions, identify the Prefix expression.
Infix expression: P-Q-(R+S)/(W-X)*Y+Z
Postfix Expression: PQRS+*WX-Y*/Z+
A. -P/*Q+RS+*-WXYZ
B. -P/*Q+RS+*W-XYZ
C. P-/*Q+R+S*WXYZD. P-/*+RS+Q*-WXYZ

In a Singly Circular Linked List, how many address fields are there?
A. 1+1
B. 2+1
C. 1
D. 2

Which of the following is NOT a logical operator?
A. !
B. &&
C. ||
D. &

The data modelling phase consists of which of the following?
A. Creation of evaluation tool
B. Creation of big data analysis model
C. Creation of infographics
D. Creation of the logical data model.

Select the best suitable answer for the below functions.
1. sizeof()
2. strlen

A. sizeof() – Returns size of string including null characters
    strlen() – Returns size of string excluding null characters
B. sizeof() – Returns size of string including null characters
    strlen() – Returns size of string including null characters
C. sizeof() – Returns size of string excluding null characters
    strlen() – Returns size of string excluding null, characters
D. sizeof() – Returns size of string excluding null characters
    strlen() – Returns size of string including null characters

public class Main
{
    int x = 10;
    public static void main(String [] args)
    {
        try
        {
            Main t1 = new Main();
            System.out.println(t1.x);
        }
        catch(Exception e)
        {
            System.out.println("exception Caught");
            return;
        }
    }
    static
    {
       int x = 20;
       System.out.println(x+" ");
    }
}

What will be the output of the above code?

void main()
{
    char a[10][10] = {"kellos", "hellos", "fellos"};
    print("%s", a[i]);
}

What will be the output of the above program?
A. Compile time error
B. ellos hellos fellos
C. ellos
D. hellos

public class Main
{
    public static void main(string[] args)
    {
        try
        {
            int[] arr = {10,25,2,6,8,9,7,32};
            for(int i=0; i<arr.length; i++)
            {
                System.out.print(arr[i+1]);
            }
        }
        catch(Exception e)
        {
            System.out.println("Inside Exception");
        }
    }
}

What will be the output of the following program?

class car
{
    public vpid Show()
    {
        System.out.println("Brand is not defined yet");
    }
}
class mercedes extend car
{
    public void Show()
    {
        System.out.println("It's mercedes");
    }
}
class Benz extends mercedes
{
    
}
public class Main
{
    public static void main(String[]args)
    {
        car obj = new Benz();
        obj.Show();
    }
}

What will be the output?
A. It’s mercedes
B. Run Time Error
C. Compile Time Error
D. Brand is not defined yet

Also Checkout

Recent Posts
Pages