GATE IT - C Programming and Computer Science Fundamentals

Practice quiz for GATE and NET competitive exams covering C programming, digital logic, algorithms, automata theory, and software engineering concepts

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which model includes user participation in software development?

  1. Waterfall model
  2. Iterative enhancement model
  3. Spiral model
  4. RAD model
  5. Prototype model
Question 2 Multiple Choice (Single Answer)

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
Question 3 Multiple Choice (Single Answer)

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+bcc)bcc(c+b)
  5. L(bcb*(b+c)bcc*)
Question 4 Multiple Choice (Single Answer)

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
Question 5 Multiple Choice (Single Answer)

Consider :
72n+n2 ≤ 62n for n ≥ 4
Find the complexity for the given equation.

  1. O(2<sup style="font-family:">n)
  2. Θ(n<sup style="font-family:">2)
  3. ɸ(6*2<sup style="font-family:">n)
  4. Ω(2<sup style="font-family:">n)
  5. Both 1 and 4
Question 6 Multiple Choice (Single Answer)

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
Question 7 Multiple Choice (Single Answer)

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
Question 8 Multiple Choice (Single Answer)

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
Question 9 Multiple Choice (Single Answer)

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
Question 10 Multiple Choice (Single Answer)

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
Question 11 Multiple Choice (Single Answer)

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
Question 12 Multiple Choice (Single Answer)

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
Question 13 Multiple Choice (Single Answer)

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
Question 14 Multiple Choice (Single Answer)

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
Question 15 Multiple Choice (Single Answer)

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
Question 16 Multiple Choice (Single Answer)

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
Question 17 Multiple Choice (Single Answer)

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
Question 18 Multiple Choice (Single Answer)

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
Question 19 Multiple Choice (Single Answer)

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
Question 20 Multiple Choice (Single Answer)

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