TCS Technical MCQs - 25 October 2020 - Slot 1

Questions 31: What will be the output of the given program?

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

  • Options
  • a : ellos
  • b : Compile time error
  • c : hellos
  • d : ellos hellos fellos
  • Answer: c) hellos

    Questions 32: In a Singly Circular Linked List, how many address fields are there?

  • Options
  • a : 2+1
  • b : 1+1
  • c : 2
  • d : 1
  • Answer: d) 1

    Questions 33: What will be the output of the following program ?

    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.println(arr[i+1]);
    }
    }
    catch(Exception e)
    {
    System.out.println("Inside Exception");
    }
    }
    }

    Type your answer in box.

    Answer:
    25
    2
    6
    8
    9
    7
    32
    Inside Exception

    Questions 34: What will be the output ?

    class car
    {
    public void Show()
    {
    System.out.println("Brand is not defined yet");
    }
    }


    class mercedes extends car {
    public void Show()
    {
    System.out.println("Its mercedes");
    }
    }

    class Benz extends mercedes{
    }

    public class Main
    {
    public static void main(String args[]){
    car obj=new Benz();
    obj.Show();
    }
    }

  • Options
  • a : Brand is not defined yet
  • b : Its mercedes
  • c : Compile Time Error
  • d : Run Time Error
  • Answer: b) Its mercedes

    Questions 35: Select best suitable answer for below functions

    1. sizeof()
    2. strlen

  • Options
  • a : sizeof() - Returns size of string including null characters
    strlen() - Return size of string excluding null characters
  • b : sizeof() - Returns size of string including null characters
    strlen() - Return size of string including null characters
  • c : sizeof() - Returns size of string excluding null characters
    strlen() - Return size of string including null characters
  • d : sizeof() - Returns size of string excluding null characters
    strlen() - Return size of string excluding null characters
  • Answer: a) sizeof() - Returns size of string including null characters
    strlen() - Return size of string excluding null characters

    Questions 36: 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

  • Options
  • a : 7
  • b : 3
  • c : 1
  • d : 5
  • Answer: NA

    Questions 37: Which of the following is NOT a logical operator?

  • Options
  • a : !
  • b : &
  • c : ||
  • d : &&
  • Answer: b) &

    Questions 38: The data modeling phase consists which of the following ?

  • Options
  • a : Creation of the logic data model
  • b : Creation of evalution tool
  • c : Creation of infographics
  • d : Creation of bigdata analyis model
  • Answer: a) Creation of the logic data model

    Questions 39: What will be the output of the below code?

    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 cought");
    return ;
    }
    }
    static {
    int x= 20;
    System.out.println(x+" ");
    }
    }

    Answer: Compile Time error

    Questions 40: Based on below infix and postfix expressions, identify prefix expressions ?

    Infix Expression: P - Q * ( R + S ) / ( W - X ) * Y + Z

    Postfix Expression : P Q R S + * - W X - Y * / Z +

  • Options
  • a : P-/*Q+R+S*WXYZ
  • b : P-/*+RS+Q*-WXYZ
  • c : -P/*Q+RS+*-WXYZ
  • d : -P/*Q+RS+*W-XYZ
  • Answer: NA


    TCS
    If you find any question wrong, please send your solution to [email protected]