Dark Mode On/Off

# GATE 2020 - Programming and Data Structures

This Test will cover complete Programming and Data Structures with very important questions, starting off from basics to advanced level.
Q. The value of `ab`, if `ab & 0 x 3f` equals `0 x 27` is __________?
 A. `047` B. `0 x 0f` C. `0 x f3` D. `0 x 27`
Q. In C programming language, if the first and the second operands of operator `+` are of types `int` and `float`, respectively the result will be of type ___________?
 A. Int B. Float C. Char D. Long Int
Q. What is the output of the following 'C' program?
``````main()
{
int a[5] = {2,3};
printf("\n%d%d%d",a[2],a[3],a[4]);
}``````
 A. Garbage values B. 2 3 3 C. 3 2 2 D. 0 0 0
Q. What is the output of the following 'C' program?
``````main()
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e = {"Tiger"};
printf("\n%d%f", e.age, e.sal);
}``````
 A. Error B. Garbage values C. 0.000000 D. 10.000000

Q. If a file contains the line "I am a boy\r\n", then on reading this line into the array `str` using `fgets()`, what would `str` contain?
 A. "I am a boy\r\n\0" B. "I am a boy\r\0" C. "I am a boy\n\0" D. "I am a boy"
Q. How many times will the following loop be executed if the input data item is 01234 ?
``````while(c=getchar() != 0)
{

}``````
 A. Infinitely B. Never C. Once D. 5 times
Q. The function `sprintf()` works like `printf()`, but operates on __________?
 A. Data in a file B. Stderr C. Stdin D. String
Q. Feature for accessing a variable through its address is desirable because __________?
 A. Call by reference is otherwise impossible B. Call by value is otherwise impossible C. A function can return more than one value using this D. It can be used to cause side effects
Q. In the statement ` template &<class T> `,
 A. T is a class B. T is a scalar variable C. Either (a) or (b) D. None of these

Q. In C programming language, which of the following operators has the highest precedence?
 A. Unary ` + ` B. ` * ` C. ` >= ` D. ` == `
Q. In the code below the output of `puts(x)` and `puts(y)` will be,
``````
char x[] = "WHATIZIT";
char *y = "WHATIZIT";
``````
 A. The same B. Different C. Not related D. None of these
Q. Which of the following statements is incorrect?
 A. C provides no input-output features B. C provides no file access features C. Provides no features to manpulate composite objects D. All of these
Q. The function that is actually created from a call to a template function is called?
 A. Generated B. Inherited C. Spawned D. Declassified
Q. The value of an automatic variable that is declared but not initialised will be?
 A. 0 B. -1 C. Garbage D. None of these
Q. If the declaration `unsigned c:5` is replaced by `unsigned :6`, then
 A. It results in a syntax error B. It is meaningless C. Compiler will give a new name for the field D. None of these