TCS Technical MCQs - 24 October 2020 - Slot 2

Questions 21: What is the name of the method that examines particular data entity and determines what data elements need to be associated with it ?

  • Options
  • a : Functional Primitive
  • b : Logic data modeling
  • c : Customer Entities
  • d : Entity Relationship diagram
  • Answer: d)Entity Relationship diagram

    Questions 22: What will be output for the below ?

    public class main
    {
    public static void main(String[] args)
    {
    int x = 1/2;
    if(x == 0.5)
    System.out.println(x+1);
    else
    System.out.println(x*2);
    }
    }

    Enter your answer ONLY as a NUMERAL, in the box.
    Note: In this question, you have to enter a value in given box which should be the output of the code.

    Answer: 0

    Explanation:
    x will be assigned with 0. On comparing 0 with 0.5, we will get false, hence else will be executed, 0 * 2 = 0

    Questions 23: Which of the following functions is used to accept string with white spaces ?

  • Options
  • a : getString();
  • b : scanf();
  • c : gets();
  • d : getWhiteSpaceString();
  • Answer: c) gets();

    Questions 24: Select the correct code for opening a file for writing in binary mode.

  • Options
  • a : FILE *f = fwrite("abc.bin","b");
  • b : FILE *f = fopen("abc.bin","wb");
  • c : FILE *f = fwriteb("abc.bin");
  • d : FILE *f = fopen("abc.bin","bw");
  • Answer: b) FILE *f = fopen("abc.bin","wb");

    Questions 25: We CANNOT overload ________ operator.

  • Options
  • a : +
  • b : ::
  • c : ()
  • d : []
  • Answer: b) ::

    Questions 26: What is the mathematical function used to round off 6.23 to 7 ?

  • Options
  • a : floor(6.23, 7)
  • b : ceil(6.23)
  • c : floor(6.23)
  • d : ceil(6.23, 7)
  • Answer: b)ceil(6.23)

    Questions 27: Which argument is passed to fflush() ?

  • Options
  • a : stderr
  • b : no parameter
  • c : stdin
  • d : stdout
  • Answer: c) stdin

    Questions 28: What will be the output-

    public class Main {
    public static void main(String[] args)
    {
    int $ = 5;
    }
    }

  • Options
  • a : Nothing will print
  • b : Symbol not found Error
  • c : Runtime Error
  • d : Compile time error
  • Answer: a) Nothing will print

    Questions 29:

    class Main
    {
    public static void main(String args[])
    {
    int i,j,x=0;
    for(i=0;i<5;i++)
    for (j=0;j<5;j++){
    x=(i+j-1);
    System.out.print(x);
    break;
    }
    System.out.print(x);
    }
    }
    What will be printed when the above sample code is executed.
    Enter your answer ONLY as a NUMERAL, in the box.

    Note: In this question, you have to enter a value in given box which should be the output of the code.

  • Options
  • a : -101233
  • b : 101233
  • c : 101200
  • d : -111233
  • Answer: a)-101233

    Questions 30: When we declare constant pointer to integer, we CANNOT change -

  • Options
  • a : Value pointed by pointer
  • b : Address in the pointer variable.
  • c : Changes are not permitted
  • d : Address of pointer
  • Answer: b) Address in the pointer variable.


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