Maximum time 20 min
Maximum marks 50
Read the following instructions very carefully
before you proceed.
1.
Choose the best choice for given choice in each of these questions.
2. You will be given 2.5 marks for the correct answers and -1 for the
incorrect answers.
1) Structure can be used
A) To hold different datatypes
B) Have pointers to structure
C) To assign to one another
D) All the above
#include<stdio.h>
Int
main()
{
Extern
int a;
Printf(“%d\n”,a);
Return
0;
)
Int
a=20;
3) C language is available for which of the
following Operating System?
A)
DOS
B)
Windows
C)
Unix
D)
All of these
4.
What is the output of the following program ?
#include
Int
main()
{
Int
I,j;
I
= j =2;
While
( --I && j++)
printf(“%d %d”,I,j);
return
0;
}
5.
The size of generic pointer in c is 2 __
A)
Bytes
B
) Bits
6.
What is the problem in the following declarations?
Int
func(int);
Double
func(int);
Int
func(fload);
A) A function with same name
connot have different signatures.
B) A function with same name
cannot have different return types.
C) A function with same name
cannot have differene number of parameters
D) All of the mentioned.
7.
The smallest integer than can be represented by an 8-bit number in 2’s
complement form is
A)
-256
B)
-128
C)
-127
D)
0
8.
The five items: A,B,C,D and E are pushed in stack, one after the other starting
from A. The stack is
Is
popped four items and each element is inserted in a queue. Then two elements
are deleted from the queue and pushed back on the stack . Now one item is
popped from the stack.
The
popped item is.
A) A
B) B
C) C
D) D
9.
What is the output of the following code?
#include
<stdio.h>
Void
main()
{
Int
a=0, b=0;
A
= (b =75)+9;
Printf(“\n%d,
%d “,a,b);
10.
How many times “Nagarro will get printed?
#include<stdio.h>
Int
main()
{
Int x;
For
(x=-1; x<10;x++)
{
If
(x<5)
Continue;
else
break;
printf(“Nagarro”);
}
Return
0;
}
A) Infinite times
B) 11 times
C) 0 times
D) 10 times
11
Which
of the following function is correct that finds the length of a string?
A)
Int xstrlen (char *s)
{
Int
length=0;
While
(*s!=’\0’)
{
length++; s++; }
Return
(length);
}
B)
int xstrlen (char s)
{
Int
length=0;
While
(*s!=’\0’)
{
length++; s++; }
return
(length);
}
C)
int xstrlen (char *s)
{
int
length=0;
While
(*s!=’\0’)
{
length++; }
Return
(length);
}
D)
int xstrlen (char *s)
{
int
length=0;
While
(*s!=’\0’)
{
s++; }
Return
(length);
}
12.
Declare the following statement ?
“An
Array of three pointers to chars”
A) Char *ptr[3]();
B) Char *ptr[3];
C) Char (*ptr[3]) ();
D) Char **ptr[3];
13.
How will you print \n on the screen ?
A)
printf(“\n”);
B)
echo \\n;
C)
printf(“\n”);
D)
printf(\\n);
14.
The use of the break statement is switch statement is
A)
otional
B)
compulsory
C)
not allowed. It gives an error message
D)
to check an error
E)
None of the above
15.
What logic function is produced by adding an inverter to each input and the
output of and OR gate?
A)
NAND
B)
NOR
C)
XOR
D)
AND
16.
Conversion of binary number 11110 to hexadecimal is
A)
36
B)
30
B)
F0
D)
1E
17.
Let P be a quick sort program to sort numbers in ascending order using the
first element as the pivot. Let t1 and t2 be the number of comparisons made by
P for the input [1 2 3 4 5] and [4 1 5 3 2] respectively. Which one of the
following holds?
A)
t1 = 5
B)
t1 < t2
C)
t1 > t2
D)
t1 = t2
18
Identify the correct order in which the following actions take place in ad
interaction between web browser and web server.
1) The web browser request a
webpage using HTTP.
2) The web browser establish a
TCP connection with the web server.
3) The web web server send the
requested webpage using HTTP.
4) The web browser resolves the
domain name using DNS.
A)
4,2,1,3
B)
1,2,3,4
C)
4,1,2,3
D)
2,4,1,3
19.
The Boolean expression AB + AB’ + A’C + AC is unaffected by the value of
Boolean variable:
A)
A
B)
B
C)
C
D)
None of the above
20.
Consider the C function given below. Assume the array list A contains n(>0)
elements, sorted in ascending order.
Int
Process Array (int * list A, int x, int n)
{
Int
I, j, k;
I
=0;j=n-1;
do
{
k
= i+j)/2;
if
(x<=listA [k])
j=k-1;
if
(listA[k} <=x)
I
=k+1;
}
while (l <=j);
If
(listA [k] == x)
Return
(k);
Else
Return
-1;
}
Which
one of the following statements about the function process Array is CORRECT?
A) It will run into an infinite
loop when x is not in listA
B) It is an implementation of
binary search
C) It will always find the
maximum element in listA
D) It will return -1 even when x
is present in listA