TCS programming mcq questions

 

Hello frnds here are the top 10 Q/A you should know about c  : –

(To download the more question in pdf format click link below q.no-10)

TCS programming mcq questions

1.In C programming, how do you insert quote characters (‘ and “) into the output screen?

Answer: This is a common problem for beginners because quotes are normally part of a printf statement. To insert the quote character as part of the output, use the format specifiers \’ (for single quote), and \” (for double quote).

2.What is the use of a ‘\0′ character?

Answer: It is referred to as a terminating null character, and is used primarily to show the end of a string value

3.What is the difference between the = symbol and == symbol?

Answer: The = symbol is often use in mathematical operations. It is used to assign a value to a given variable. On the other hand, the == symbol, also known as “equal to” or “equivalent to”, is a relational operator that is used to compare two values

4.Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

Answer :  <> is
incorrect. While this operator is correctly interpreted as “not  equal to” in writing conditional statements, it is not the proper
operator to be used in C programming. Instead, the operator  !=  must
be used to indicate “not equal to” condition.

5.Can the curly brackets { } be used to enclose a single line of code?

Answer: While curly brackets are mainly used to
group several lines of codes, it will still work without error if you used it
for a single line. Some programmers prefer this method as a way of organizing
codes to make it look clearer, especially in conditional statements. 

6.What are header files and what are its uses in C programming?

Answer: Header files are also known as library
files. They contain two essential things: the definitions and prototypes of
functions being used in a program. Simply put, commands that you use in C
programming are actually functions that are defined from within each header files.
Each header file contains a set of functions. For example: stdio.h is a header
file that contains definition and prototypes of commands like printf and
scanf. 

7.Can I use  “int” data type to store the value 32768? Why?

Answer: No. “int” data type is capable of storing
values from -32768 to 32767. To store 32768, you can use “long int” instead.
You can also use “unsigned int”, assuming you don’t intend to store negative
values.

8.Can two or more operators such as \n and \t combine in a single line of program code?

Answer: Yes, it’s perfectly valid to combine
operators, especially if the need arises. For example: you can have a code like
” printf (“Hello\n\n\’World\’”) ” to output the text “Hello” on the first line
and “World” enclosed in single quotes to appear on the next two lines. 

9.Why is it that not all header files which are declare in every C program?

Answer: The choice of declaring a header file at the
top of each C program would depend on what commands/functions you will be using
in that program. Since each header file contains different function definitions
and prototype, you would be using only those header files that would contain
the functions you will need. Declaring all header files in every program would
only increase the overall file size and load of the program, and is not
considered a good programming style.

10.How do you generate random numbers in C?

Answer: In C programming language, It generates Random numbers using the
rand() command. For example: anyNum = rand() will generate any integer number
beginning from 0, assuming that anyNum is a variable of type integer.

TCS programming mcq questions and To get series of question which may be asked in your viva examination click link below to download pdf.

Download link:-  c viva questions

To get more MCQ on C programming click here : https://www.soluversity.in/quiz-4-c-programming-language

You may also like...

7 Responses

  1. Prabhat Singh says:

    hello frnds just live your comments below

  2. Nice written and well arranged.
    Profitable for newbie, and many of thr terms available is looking similar to Java.

  3. Prabhat Singh says:

    thnx animesh singh

  4. Tarun Kumar Patel says:

    Nice Thought Prabhat, keep it up

Leave a Reply

Your email address will not be published. Required fields are marked *