TCS Programming MCQ - Set 7

TCS NQT Programming MCQ 

TCS NQT Programming MCQ - SimpleWay2Code



Ques 1. In a doubly circular linked list what will be the contents of right address field of last node?

a) NULL

b) Garbage value

c) Depends on User

d) Address of first node ✅


Ques 2. Which combination of the integer variables a, b and c makes the variable m get the value 4 in the following expression? m = (a> b)? ((a>c)? a:c): (( b>c) ? b:c) ?

a) a=6, b=3, c=5

b) a=3, b=4. c=2 

c) a=5, b=4, c=5

d) a=6, b=5, c=3


Ques 3. A connected graph has 3 regions and 8 edges. Find the number of vertices.

a) 11

b) 8

c) 5

d) 7 ✅


Ques 4. When we sort the given elements by using bubble sort, then in third pass/iteration how many comparisons should we perform?

25,17,31,13,2


a) 2

b) 4

c) 1

d) 3 ✅


Ques 5. What will be output of below snippet?

class Test {

      public static void main(StringÅ¿ args) throws NullPointerException{

    int a [] = {1,2};

    System.out.println("Hello");

    System.out.println("User");

    System.out.println(a[1]); 

    }

}

O/p : ? Hello 

            User

            2


Ques 6. Suppose we initialize array like int a[5]={10,20,30};

Then what will happen?

a) First two elements will be zero

b) Last two elements will be zero ✅

c) Remaining elements will be garbage elements

d) Error message from the compiler


Ques 7. When we execute the given code which character will be printed?


int main(){

   char *name={"abc",

   "def",

   "ghi",

   "jk"};

    printf("%c",*name[2]+2); 

    return 0;

}


O/P: ? Error


Ques 8. What will be the output of below code?

import java.util.*;

public class Main

static int sample(){

          return (true ? null : 0);

}

public static void main(String[] arr){

        System.out.println(Main.sample());

}

}


a) Compile Time Error

b) Runtime ✅

c) 0

d) NULL


Explanation:

Exception in thread "main" java.lang.NullPointerException

at Main.sample(Main.java:4)

at Main.main(Main.java:7)


Ques 9. Consider following tree, what will be in order for traversal?

a)  5,6,8,9,17,10,18,20,23,24,25,29

b)  5,6,8,9,10,17,18,20,23,24,25,29 

c)  5,6,8,9,18,10,17,23,20,24.25,29

d)  5,6,8,9,10,17,20,18,23,24,25,29


Ques 10. The tool that depicts progress of tasks against time, is called as:

a)  Mentimeter

b)  Bar Chart

c)  Polygraph

d)  Gantt Chart ✅


This Blog is Hard work !

Can you give me a treat 😌


Post a Comment

0 Comments