0

GATE, NET

Attempted 0/20 Correct 0 Score 0

Which model includes user participation in software development?

  1. Waterfall model

  2. Iterative enhancement model

  3. Spiral model

  4. RAD model

  5. Prototype model


Correct Option: D
Explanation:

Rapid Application Development Model.  RAD involves the user feedback and interaction at every stage in this technique. 

Which of the following is a header file for the inbuilt function iniscr ( ) in C language?

  1. conio.h

  2. dos.h

  3. maths.h

  4. curses.h

  5. stdio.h


Correct Option: D
Explanation:

It defines several variables, structures and function prototype. Two of these variables are LINES and COLSIt is used to create logical screen/windows called stdscr.

Consider the grammar: G1=({S,S1,S2},{a,b},S,P), with the following productions: P:S → S1bc,S1→ S1bc|S2,S2 →b Give the regular language for the above.

  1. L(((bc*)c))

  2. L((bc(b+bc)*(c+cc))

  3. L(bbc(bc)*)

  4. L(b+bc*c)bc*c(c+b)

  5. L(bcb*(b+c)bcc*)


Correct Option: C
Explanation:

Replacing the first production with S1→ S1bc, and we can keep doing this again and again. after some repetitive steps will get S→S2bcbcbcbc Finally will replace S2 with S2 →b; and will get bbc(bc)*

Which of the following is true about virtual base class?

  1. Multilevel, multiple and hierarchical inheritance’s instances are not involved.

  2. No such concept like virtual base class exists only functions can be made virtual.

  3. It creates only one instance of the super class.

  4. It helps in creating redundant data, when we want to achieve data security.

  5. Both 2 and 3


Correct Option: C
Explanation:

Virtual base class creates one instance of the super class.

Consider : 7*2n+n2 ≤ 6*2n for n ≥ 4 Find the complexity for the given equation.

  1. O(2n)

  2. Θ(n2)

  3. ɸ(6*2n)

  4. Ω(2n)

  5. Both 1 and 4


Correct Option: A
Explanation:

 Correct choice

What is the output of the given program snippet in C language? main() {
int x=10,a=20;
clrscr(); x=(a==!!a); printf(%d,x&&a); getch(); }

  1. 0

  2. 1

  3. 10

  4. 20

  5. No output


Correct Option: A
Explanation:

x=(a==!!a);!a=0, !!a=1 So 20 is not equal to 1. Hence x is 0.

How many minimum inputs would be required to get 37 output lines in a decoder?

  1. 5

  2. 7

  3. 6

  4. 8

  5. 4


Correct Option: C
Explanation:

m<=27 m is the number of total output lines required. 26 is 64 and 25 is 32. Hence 37>32 but 37<64 6 is the required number of input lines.

What is the output of the given program snippet in C Language? main() {
int a=0.5,c=0.5;
float b=2,d=4;
if(b=d&&a++<=c) printf(This is true);
else
printf(This is false); }

  1. Compilation error: Incompatible types

  2. This is false

  3. This is true

  4. Runtime exception

  5. None of these


Correct Option: C
Explanation:

b=d is not a comparison but d’s value is assigned to b, and returns true and a++<=c will result true too. “This is true” will be printed.

What will be the output of the following code snippet in C language? main() {
int j=0,i;
clrscr();
for(printf(nValue is not initialized here.); j++;) {
if(j>10) break;
else {
i=j*2; printf(%d,i);
}
}
getch(); }

  1. Infinite loop

  2. Syntax error

  3. Value is not initialized here

  4. 24681012141618

  5. 1820


Correct Option: C
Explanation:

Test expression not specified at right place, still the for loop wont execute even once But j++ would yield 0 as j’s read value will be 0, after which it is incremented.

What will be the result of the given code snippet in C language? main() {
int x=1;
clrscr(); for(;x++;x%10?0:1) {
printf(%d,x*x); }
getch(); }

  1. Compilation error

  2. No output

  3. 149162536496481

  4. 49162536496481

  5. Infinite loop


Correct Option: E
Explanation:

x++ will always result in a non zero value and hence loop will never terminate.

What will be the output of the following code snippet in C language? Assume that all preprocessor directives are correct. main() {
int a=11;
clrscr(); a++ +=10;
printf("%d",a); getch(); }

  1. 22

  2. 23

  3. 12

  4. Compilation error: Lvalue required in function main

  5. Compilation error: Rvalue required


Correct Option: D
Explanation:

The program code will give an error while compilation. 

Consider the following code. What will be the values of a, x, y and z? main() {
int x=10,y=20,z=30,a=0; clrscr();
a=(x+=y)||(y+=z);
getch(); }

  1. a=0, x=10, y=20, z=30

  2. a=1, x=30, y=50, z=30

  3. a=0, x=30, y=50, z=30

  4. a=1, x=30, y=20, z=30

  5. a=1, x=10, y=50, z=30


Correct Option: D
Explanation:

X+=y gives 30, which is a non zero value and logical or operator returns 1, when there is atleast one non zero value. Thus retrieving a non zero value already terminates before calculating y+=z.

What will be the output of the following code snippet? main() {
int a=11,b; clrscr();
for(a%10;a++); printf(%d,a%10?0:1);
getch(); }

  1. 111111111

  2. 1111111110

  3. 0000000001

  4. 000000000

  5. 0000000000


Correct Option: D
Explanation:

If a%10 yields non zero value, then 0 would be printed until a%10==0

What will be the output of the following code snippet? main() {
int a=1,b=1;
clrscr();
a=++a||++b&&++a;
printf(a=%d, b=%d,a,b); getch(); }

  1. a=3, b=2

  2. a=2, b=1

  3. a=1, b=1

  4. a=1, b=2

  5. a=2, b=2


Correct Option: C
Explanation:

a=++a||++b&&++a; As we know, logical OR requires atleast one operand to be 1, ++a delivers a non zero value and hence the rest of the expression will not be evaluated and result 1 is assigned to a again.

Consider the below given code: main() {
int i=0; //line 1
clrscr();
printf(%d,i); i++;
if(i!=10)
main(); getch(); } The above code snippet will run in an infinite loop. What resolution shall be applied in order to terminate the loop as well?

  1. int static i=0;

  2. const int i=0;

  3. declaring variable i as global

  4. static int i=0;

  5. none of these


Correct Option: D
Explanation:

A static variable sustains its value until the program execution.

What will be the output of the following code snippet? main() {
int num=1;
clrscr();
for(j=1;j<=6;j++) {
for(i=j;i>=1;i--) {
for(k=1;k<=i;k++)
num*=k; }
}
printf(The num is: %d,num); getch(); }

  1. 1

  2. 6912

  3. 0

  4. 216

  5. 720


Correct Option: C
Explanation:

After num reached the negative end it becomes 0 and 0 multiplied by 0 yields 0.

Consider the given number system. (123)10 = (234)? What will be the base for 234?

  1. 5

  2. 6

  3. 9

  4. 7

  5. 10


Correct Option: D
Explanation:

Coefficient values for the number system with base five are 0, 1, 2,3,4,5 and 6.The number in base-7 is equivalent to decimal 123.

Where is the file pointer fp pointing to after below mentioned statement? fseek(fp, 49, sizeof (Variable type),0);

  1. Begining of the file

  2. End of the file

  3. 49th element of the file

  4. 0th element of the file

  5. Beginning of the 50th record


Correct Option: E
Explanation:

fseek() adjust the current position in the data file pointed to by the file pointer fp so as to be an offset of 49 X sizeof (Variable type) bytes, hence pointer is at the beginning of the 50th record, which has to be modified.

What will be the output of the code snippet? int funct(a,b) int a,b; { return a*b; } void main() { int i=135,k;
clrscr(); k=funct(!++i,!i++); printf(i=%d,k=%d,i,k);
getch(); }

  1. i=137, k=0

  2. i=137, k=18225

  3. i=135, k=18769

  4. i=137, k=18769

  5. i=135, k=0


Correct Option: A
Explanation:

k=funct(!++i,!i++);resulting i=137!++i=0, !i++=00*0 =0, k=0

What will be the output of the following code snippet? main() {
clrscr();
char ch[]=Hello;
switch(ch) { case world: printf(World);
break;
case Hello: printf(Hello); break; default: printf(default.);
}
getch(); }

  1. Compilation error: switch selection expression must be of integral type

  2. Hello

  3. Compilation error: constant expression required

  4. Compilation error: duplicate case

  5. Options 1,3 and 4


Correct Option: E
Explanation:

All the three errors occurred.

- Hide questions