github

Made bySaurav Hathi

TCS - Company Specific Mock Test - Programming - Set 2

Q1:

Which algorithm is used to solve a maximum flow problem?

Tags:
ct04
IN04
Section:
Algorithms
Options:
Q2:

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

Tags:
JIS_Mock
IN04
Section:
Algorithms
Options:
Q3:

What will be the output of the following java code?

import java.util.*;
class Main
{
	public static void main(String[] args) 
	{
		ArrayList obj = new ArrayList();
		for(int i=1;i<=5;i++)
		    obj.add(i);
		obj.remove(3);
		System.out.println(obj);
	}
}

 

Tags:
L&T_InfoTech1
NEW_Q
Other_TY_Baseline
Bosch
Section:
Core Programming
Options:
Q4:

What will be the output of this java program?

class PassA

{

public static void main(String [] args)

{

PassA p = new PassA();

p.start();

}

void start()

{

long [] a1 = {3,4,5};

long [] a2 = fix(a1);

System.out.print(a1[0] + a1[1] + a1[2] + " ");

System.out.println(a2[0] + a2[1] + a2[2]);

}

long [] fix(long [] a3)

{

a3[1] = 7;

return a3;

}

}

Tags:
java
Section:
Core Programming
Options:
Q5:

#include<iostream>

using namespace std;

class XYZ

{

public:

int x;

};

int main()

{

XYZ a = {20};

XYZ b = a;

cout << a.x << " " << b.x;

return 0;

}

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

Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?

Tags:
java
Section:
Core Programming
Options:
Q7:

Which of the following operators should be preferred to overload as a global function rather than a member method?

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

Which of the following statements is NOT valid about operator overloading?

Tags:
c++
ct02
Section:
Core Programming
Options:
Q9:

What will be the output of this C program ?

#include<stdio.h>

int main()

{

char str[ ] = "Hello\0World";

printf("%s", str);

}

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

What will be the output of the following C code?

#include <stdio.h>
int main()
{
    char *a="Perfectice";
    printf("%d",sizeof(a));
    return 0;
}

Tags:
TCSTest2
NEW_Q
Section:
Core Programming
Options: