Time: 35 Min
50-Marks
1) C is
which kind of language?
(a) Machine
(b) Procedural
(c) Assembly
(d) Object-oriented
2) double x = -3.5, y = 3.5;
printf( "%.0f : %.0f\n", ceil( x
), ceil( y ) );
printf
( "%.0f : %.0f\n", floor( x), floor( y ) );
What will the code above print when
executed?
(a)
-3: 4
-4: 3
(b)
-4: 4
-3:
3
(c)
-4: 3
-4: 3
(d)
-4: 3
-3: 4
3) struct
customer *ptr = malloc( sizeof( struct customer ) )
Given the sample allocation for the
pointer "ptr" found above, which one of the following statements is used to reallocate ptr to be an array of 10 elements?
(a) ptr = realloc( ptr, 10 * sizeof( struct
customer));
(b)
realloc( ptr, 9 * sizeof( struct customer ) );
(c) ptr
+= malloc( 9 * sizeof( struct customer ) );
(d)
ptr = realloc( ptr, 9 * sizeof( struct customer ) );
4) #include <stdio.h>
int
i;
void
increment( int i )
{ i++; }
int
main()
{
for( i = 0; i < 10; increment( i ) )
{ }
printf("i=%d\n",
i);
return
0;
}
What
will happen when the program above is compiled and executed?
(a)
It will not compile. (b) It will print out: i=9.
(c)
It will print out: i=10. (d) It will
loop indefinitely.
________________________________________________________________________
5) int i
= 4;
switch (i)
{
default:
;
case 3:
i +=
5;
if ( i == 8)
{
i++;
if (i == 9) break;
i *= 2;
}
i -= 4; break;
case 8:
i += 5;
break;
}
printf("i = %d\n", i);
What will the output of the sample code
above be?
(a) i
= 5 (b) i = 8
(c) i = 9
(d) i = 10
6) What
does the "auto" specifier do?
(a) It automatically initializes a variable
to 0;.
(b)
It indicates that a variable's memory will automatically preserved.
(c)
It automatically increments the variable when used.
(d)
It automatically initializes a variable to NULL.
7) What is the output of the following code?
#
include<stdio.h>
#
define a 10
main()
{
printf("%d..",a);
foo();
printf("%d",a);
}
void foo()
{
#undef
a
#define
a 50
}
(a)
10..10 (b) 10..50
(c) Error
(d) 0
8) #include<stdio.h>
void main()
{
int
a; printf("%d",a^a);
}
(a) 1
(b) 0 (c) Unexpected (d) Runtime Error
9) #include<stdio.h>
void swap(int&, int&);
void
main()
{
int a =
10,b=20;
swap
(a++,b++);
printf("\n%d\t%d\t",a, b);
}
void swap(int& x, int& y)
{
x+=2;
y+=3;
}
OUTPUT________________
10) #include<stdio.h>
#include<conio.h>
void
main(){
int a[]={0,1,2,3,4,5,6,7,8,9,10};
int i=0,num;
num=a[++i+a[++i]]+a[++i];
printf("%d",num);
}
(A) 6 (B)
7 (C)
8 (D)
9
11) #include<stdio.h>
#include<conio.h>
void main(){
int i=3,val;
val=sizeof f(i)+ +f(i=1)+
+f(i-1);
printf("%d %d",val,i);
}
int f(int num){return num*5;}
(A) 2 0 (B) 9 1 (C)17 0 (D)2 1
12) #include<studio.h>
int
main(){
for(;NULL;)
printf("cquestionbank");
return 0;
}
(A) c
(B) error (C) cquestionbank (D) Infinite loop
13) #include<stdio.h>
int
main(){
float a=0.5, b=0.9;
if(a&&b>0.9)
printf("Sachin");
else
printf("Rahul");
return 0;
}
(A) Sachin (B)
Rahul (C)
null (D) Run
time error
14) main()
{
struct
{
int i;
}xyz;
(*xyz)->i=10;
printf("%d",xyz.i);
}
What
is the output of this program?
(a)
program will not compile (b) 10
(c) god only knows (d) address of I
15)
What will be the output of the following program ?
main()
{
for ( ; ; )
main();
}
(a)Compile-Time error (b)Run-Time
Error (c)Infinite Loop (d)None
16)
What will be the output of the following program ?
void main()
{
int a=5,b=1,c;
c = a ? a=1 : b=2;
printf("%d %d %d",a,b,c);
}
(a)Compile-Time Error (b)2
2 2 (c)1 1 1 (d)None
of these
17)
What will be the output of the following program ?
main()
{
unsigned _=5;
_=_--- ++_;
printf("%d",_);
}
(a)Compile-Time Error (b)5 (c)65535 (d)-1
18)
What will be the output of the following program ?
int add(int a,int b)
{
return a+b;
}
main()
{
int a=1,b=2;
printf("%d",add(add(add(a,b),add(a,b)),add(add(a,b),add(a,b))));
}
(a)Garbage value (b)Run-Time
Error (c)Compile-Time Error (d)12
19)
What will be the output of the following program ?
void main()
{
int a=5,b=6,c=7,d=8,e;
e = a ? b , c : c , d;
printf("%d",e);
}
(a)Compile-Time Error (b)6 (c)7 (d)8
20)
What will be the output of the following program ?
void main()
{
int a=5,b=6,c;
c++ = b % (b - a);
printf("%d",c);
}
(a)Compile-Time Error (b)6 (c)7 (d) None
21)
What will be the output of the following program ?
void main()
{
int x=5,y=6,z;
z = x++ +++y;
printf("%d %d %d",x,y,z);
}
(a)Compile-Time Error (b)6
7 12 (c)5 6 11 (d)None
22)
What will be the output of the following program ?
void main()
{
int a=25.0;
#include<math.h>
printf("%.2lf %.2lf",sqrt(a),pow(sqrt(a)*5.0,2.0));
}
(a)Compile-Time Error (b)5
625 (c)5.00 125.00 (d)5.00 625.00
23)
What will be the output of the following program ?
#define func(x,y) { func(x,y) }
void main()
{
int a=5,b=6;
c=func(x,y);
printf("%d %d %d",c);
}
(a)Compile-Time
Error (b)Linker Error
(c)5 6 11 (d)Infinite Loop
24)
What will be the output of the following program ?
void main()
{
const val=57;
printf("%d ",val);
*(int *)&val=75;
printf("%d",val);
}
(a)Compile-Time Error (b)75
57 (c)57 75 (d)None
25)
What will be the output of the following program ?
#define print(val)
printf("x" #val "=%.2f ",x##val)
void main()
{
float x1=5.74,x2=23.78;
print(1);
print(2);
}
(a)Compile-Time
error (b)x1=5.74 x2=23.78
(c)Linker Error (d)None
of these
26)
What will be the output of the following program ?
void main()
{
int i=5;
float j=56.78;
char str[20];
scanf("%s %*d %f",str,&i,&j);
printf("%s %d %.2f",str,i,j);
}
[Assume
the INPUT values entered by the user are :testing 12345 2.25]
(a)Compile-Time
Error (b)testing 12345 2.25
(c)testing 5 2.25 (d)none
27)
What will be the output of the following program ?
main()
{
static int val=7;
int data;
if (--val)
{
data=main()+val;
printf("%d ",data);
}
return 0;
}
(a)Compile-Time
Error (b)INFINITE LOOP
(c)1 2 3 4 5 6 (d)blank
28)
What will be the output of the following program ?
#include<stdio.h>
#define d conio.h
#include<d>
main()
{
printf("%i",100);
}
(a)Error
(b)100
(b)Blank (d)None
29)
What will be the output of the following program ?
#define a 50
#define b 60
void main()
{
int sum;
sum=++a + --b;
printf("%d %d %d",a,b,sum);
}
(a)Compile-Time
Error (b)50 60 110
(c)51 59 110 (d)None
of these
30)What
will be the output of the following program ?
void main()
{
int a[5];
printf("%d",9-*a-3+*a);
}
(a)Compile-Time Error (b)6 (c)Garbage Value (d)None of these
31)
What will be the output of the following program ?
void main()
{
static int i;
while (i <= 10)
(i > 2) ? i++ : i--;
printf("%d",i);
}
(a)Compile-Time Error (b)11 (c)32767 (d)None of these
32)
What will be the output of the following program ?
void main()
{
int a=5,b=6,c;
c=(b++ == 6) || (--a < 2);
printf("%d %d %d",a,b,c);
}
(a)Compile-Time Error (b)4
7 1 (c)4 7 6 (d)5 7 1
33)
What will be the output of the following program ?
void main()
{
int *ptr;
ptr=0x1fa;
*ptr++=5000;
*ptr=6000;
printf("%d ",++*ptr--);
printf("%d",(*ptr)++);
}
(a)Error (b)6000 6000
(c)6001 5000 (d)6001
5001
34)
What will be the output of the following program ?
void main()
{
char *str="ABCDEFGHI";
printf("%c %c %c ",str[7]+1,3[++str],++*(str+5));
printf("%c %c %c",++*str,*++str,++*str++);
}
(a)Error (b)J D G E D B
(c)J E G E D C (d)J
E G D C B
35) #include<stdio.h>
#include<conio.h>
int
main()
{
/*
code will print/* hello*/
*/
printf("hello");
getch();
}
(a)Compile-Time
Error (b)hello
(c)syntax error (d)none
36)
What is the size in bytes of FAR pointer in gcc compiler?
a)2 b)4
c)8 d)NOT
37)
What is no of code segements in compact MODEL?
a)Any
number ,any size b)1 <= 16k
c)1 <= 64k d)NOT(c)
_________________________________________________________________________
38)Which header files should be included to use the
functions malloc() and calloc()?
(a)memory.h
(b)stdlib.h (c)string.h (d)dos.h
39)
What is the size in bytes of QWARD?
(a) 4 words (b) 5 words (c) 1 words
(d) 3 words
40) A
distributed database is which of the following?
(a) A single logical database that is spread
to multiple locations and is
interconnected by a network
(b) A loose collection of file that is spread
to multiple locations and is interconnected by a network
(c) A single logical database that is limited
to one location.
(d) A loose
collection of file that is limited to one location.
41)
Storing a separate copy of the database at multiple locations is which of the following?
(a) Data Replication
(b) Horizontal Partitioning
(c) Vertical Partitioning
(d) Horizontal
and Vertical Partitioning
42)
we want round of x a float value to an integer the correct way to do this?
(a)y=(int)(x+0.5)
(b)y=int(x+0.5)
(c)y=(int)x+0.5
(d)y=(int)((int)x+0.5)
43-45)
consider the following collection of relations and dependencies. Assume that
each relation is obtained through decomposition from a relation with
at-tributes ABCDEFGHI and that all the known dependencies over relation
ABCDEFGHIare listed for each question. (The questions are independent of each
other, obviously,
since
the given dependencies over ABCDEFGHI are different.) For each (sub) relation:
(a)
State the strongest normal form that the relation is in. (b) If it is not in
BCNF,
decompose
it into a collection of BCNF relations.
43. R1 (A,C,B,D,E), A → B, C →
D________________________________
44. R2 (A,B,F), AC → E, B →
F_______________________________
45. R3(A,D), D → G, G →
H__________________________
46)
In hash search what is the complexity
(a) 1
(b)2 (c)3 (d)4
47) #include<iostream.h>
#include<conio.h>
int
main()
{
int a[4]={2,4,6,8};
int
i;
for(i=0;i<4;i++)
{
cout<<" "+a[i]+i[a];
}
getch();
}
(a):4
8 12 16
(b):
4 8 12 16
(c):compile
time error
(d):none
48) 1.R=2
2.J=R*R-R
3.R=R+1
4.K=R*R-R
5.print K-J
6.let J=K
7.if R.8 then stop
8.go to 3
the result of the above logic is
(a)4,9,16,25.... (b)4,6,8,10.... (c)4,4,4,4.... (d)none
(49-50). Watch the below Algorithm for 4 digit
number X.
Step1: Add all the numbers
Step2: If it is less than 10 STOP, else
go to Step1.
49). If X=6724 then what is the end result
after applying the above
algorithm.
A. 19 B.10
C.1 D. None
50). If the 4 numbers are arranged in all
possible orders then how
many
solutions are possible.
A. ONE B. TWO
3.THREE 4. NONE
ANSWERS:
1-(b) 2- (a) 3- (a) 4- (d) 5- (a) 6- (b)
7-(c) 8-(b) 9-(ERROR)
10-(b)
11-(b) 12-(b) 13-(b)
14-(a) 15-(b) 16-(a)
17-(d) 18-(d) 19-(c)
20-(a)
21-(a) 22-(a) 23-(b)
24-(c) 25-(b) 26-(d)
27-(d) 28-(a) 29-(a) 30-(a)
31-(d) 32-(d) 33-(a)
34-(a) 35-(c) 36-(d)
37-(c) 38-(b) 39-(a)
40-(a)
41-(a) 42-(a) 46-(a) 47-(d) 48-(b) 49-(c)
50-(a)
0 comments:
Post a Comment