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
Questions
Which model includes user participation in software development?
- Waterfall model
- Iterative enhancement model
- Spiral model
- RAD model
- Prototype model
Which of the following is a header file for the inbuilt function iniscr ( ) in C language?
- conio.h
- dos.h
- maths.h
- curses.h
- stdio.h
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.
- L(((bc*)c))
- L((bc(b+bc)*(c+cc))
- L(bbc(bc)*)
- L(b+bcc)bcc(c+b)
- L(bcb*(b+c)bcc*)
Which of the following is true about virtual base class?
- Multilevel, multiple and hierarchical inheritance’s instances are not involved.
- No such concept like virtual base class exists only functions can be made virtual.
- It creates only one instance of the super class.
- It helps in creating redundant data, when we want to achieve data security.
- Both 2 and 3
Consider :
72n+n2 ≤ 62n for n ≥ 4
Find the complexity for the given equation.
- O(2<sup style="font-family:">n)
- Θ(n<sup style="font-family:">2)
- ɸ(6*2<sup style="font-family:">n)
- Ω(2<sup style="font-family:">n)
- Both 1 and 4
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();
}
- 0
- 1
- 10
- 20
- No output
How many minimum inputs would be required to get 37 output lines in a decoder?
- 5
- 7
- 6
- 8
- 4
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);
}
- Compilation error: Incompatible types
- This is false
- This is true
- Runtime exception
- None of these
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();
}
- Infinite loop
- Syntax error
- Value is not initialized here
- 24681012141618
-
1820
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();
}
- Compilation error
- No output
- 149162536496481
- 49162536496481
- Infinite loop
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();
}
- 22
- 23
- 12
- Compilation error: Lvalue required in function main
- Compilation error: Rvalue required
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();
}
- a=0, x=10, y=20, z=30
- a=1, x=30, y=50, z=30
- a=0, x=30, y=50, z=30
- a=1, x=30, y=20, z=30
- a=1, x=10, y=50, z=30
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();
}
- 111111111
- 1111111110
- 0000000001
- 000000000
- 0000000000
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();
}
- a=3, b=2
- a=2, b=1
- a=1, b=1
- a=1, b=2
- a=2, b=2
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?
- int static i=0;
- const int i=0;
- declaring variable i as global
- static int i=0;
- none of these
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
- 6912
- 0
- 216
- 720
Consider the given number system.
(123)10 = (234)?
What will be the base for 234?
- 5
- 6
- 9
- 7
- 10
Where is the file pointer fp pointing to after below mentioned statement?
fseek(fp, 49, sizeof (Variable type),0);
- Begining of the file
- End of the file
- 49th element of the file
- 0th element of the file
- Beginning of the 50th record
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();
}
- i=137, k=0
- i=137, k=18225
- i=135, k=18769
- i=137, k=18769
- i=135, 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();
}
- Compilation error: switch selection expression must be of integral type
- Hello
- Compilation error: constant expression required
- Compilation error: duplicate case
- Options 1,3 and 4