Ten Technical Interview/Aptitude Questions for you – Set 2

Ten Technical Interview/Aptitude Questions for you – Set 2

We know that most of you find technical test/interview to be the toughest part of a Placement Drive. So in this Article let’s discuss 10 common and conceptual questions which will help you understand the technical world and answer technical interview/aptitude round.

rn

Question 1: Use of an increment statement or decrement statement in C?

rn

Answer:

rn

There are actually two ways you can do this. One is to use the increment operator ++ and decrement operator – -. For example, the statement x++ means to increment the value of x by 1. Likewise, the statement x — means to decrement the value of x by 1.

rn

Two types of increments are:

rn

1. pre increment: (increment by 1 then print) and

rn

2. post increment: (print then incremented value will be in buffer). Same thing will be with decrement.

rn

Question 2: In programs we place comment symbols on some codes instead of deleting it. How does this aid in debugging?

rn

Answer:

rn

Placing comment symbols /* */ around a code, also referred to as “commenting out”, is a way of isolating some codes that you think maybe causing errors in the program, without deleting the code.

rn

Question 3: What is the use of a ‘’ character?

rn

Answer:

rn

This character is used primarily to show the end of a string value.

rn

Question 4: What is the difference between the = symbol and == symbol?

rn

Answer:

rn

The = symbol is often used 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.

rn

Question 5: In C Programming, which of the following operators is incorrect and why? ( >=, <=, <>, ==)

rn

Answer:

rn

<> is incorrect, all other operators are relational operators. 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.

rn

Question 6: Can the curly brackets { } be used to enclose a single line of code?

rn

Answer:

rn

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.

rn

Question 7: Can I use int data type to store the value 32768? Why/why not?

rn

Answer:

rn

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.

rn

Question 8: Can two or more operators such as n and t be combined in a single line of program code?

rn

Answer: Yes, it’s perfectly valid to combine operators, especially if the need arises.

rn

For example: you can have a code like ‘printf (‘Hellonn’World’)’ to output the text ‘Hello’ on the first line and ‘World’ enclosed in single quotes to appear on the next two lines.

rn

Question 9: When is the ‘void’ keyword used in a function?

rn

Answer:

rn

When declaring functions, you will decide whether that function would be returning a value or not. If that function will not return a value, such as when the purpose of a function is to display some outputs on the screen, then “void” is to be placed at the leftmost part of the function header. When a return value is expected after the function execution, the data type of the return value is placed instead of void.

rn

Question 10: Write a loop statement that will show the following output:
1
12
123
1234
12345

rn

Answer:

rn

for (a=1; a<=5; i++) {
for (b=1; b<=a; b++)
printf(“%d”,b);
printf(“n”);
}

rn

Do let us know in comments if you find these questions useful. Keep checking FACE Prep for more such useful content!

c