github

Made bySaurav Hathi

TCS - Company Specific Mock Test - Programming - Set 4

Q1:

What is the no. of colours required to colour the given graph?

Tags:
JIS_Mock
IN04
Section:
Algorithms
Options:
Q2:

What is the residual edge? (Edge u->v and reverse edge v->u)

Tags:
JIS_Mock
Section:
Algorithms
Options:
Q3:

What is the output of this java program?

class string_class

{

public static void main(String args[ ])

{

String obj = "hello";

String obj1 = "world";

String obj2 = "hello";

System.out.println(obj.equals(obj1) + " " + obj.equals(obj2));

}

}

Tags:
java
Section:
Core Programming
Options:
Q4:

Which statement is correct about the following declaration in C/C++?

int *ptr, p;

Tags:
c++
Section:
Core Programming
Options:
Q5:

Which of the following operators can’t be overloaded in C++?

Tags:
c++
Section:
Core Programming
Options:
Q6:

What is the output of this C++ program?

#include <iostream>

using namespace std;

class sample

{

public:

int x, y;

sample() {};

sample(int, int);

sample operator + (sample);

};

sample::sample (int a, int b)

{

x = a;

y = b;

}

sample sample::operator+ (sample param)

{

sample temp;

temp.x = x + param.x;

temp.y = y + param.y;

return (temp);

}

int main ()

{

sample a (4,1);

sample b (3,2);

sample c;

c = a + b;

cout << c.x << "," << c.y;

return 0;

}

Tags:
c++
Section:
Core Programming
Options:
Q7:

   What will be the output of the program?

class MyThread extends Thread

{

public static void main(String [] args)

{

MyThread t = new MyThread();

t.start();

System.out.print("one. ");

t.start();

System.out.print("two. ");

}

public void run()

{

System.out.print("Thread ");

}

}

Tags:
java
Section:
Core Programming
Options:
Q8:

Which of the following stops execution of a thread?

Tags:
java
Section:
Core Programming
Options:
Q9:

Construct the binary search tree using the values mentioned below and find the ‘Post order’ of that _________

50,7,80,9,10,100,17,3

Tags:
Vyshnavi_Infotech
goodhealth
DXC
CAT2_2022
+ 2 more
Section:
Data Structure
Options:
Q10:

In which sequence are the nodes traversed in the post-order traversal in a binary tree?

Tags:
Oracle1
NEW_Q
Bosch
CAT2_2022
+ 3 more
Section:
Data Structure
Options: