Q1. What will be output of following c program?
struct myStruct
{
int a;
char b;
}
*ptr;
int main()
{
struct myStruct ms={400,A};
printf(%d %d,ptr->a,ptr->b);
return 0;
}
a) 400 A
b) 400 65
c) 400 97
d) 0 0
ANS: d
Q2. Which is a boolean operator for logical-and?
a) &
b) &&
c) |
d) |&
Q3. What is the purpose of NOT NULL constraint?
a) allows NULL values in table
b) allow to pass NULL values in column
c) does not allow NULL values in table
, d) does not allow NULL values in column
Q4. Point out the error if any in the while loop.
main()
{
int i =0;
while()
{
printf(%d,i++);
if(i>10)
break;
}
}
a) the condition in the while loop is a must
b) the while lop must be replaced by a for loop
ANS: a
Q5. What is the output of the following program?
void main()
{
int a, *pa, &ra;
pa = &a;
ra = a;
cout «a=«a «*pa=«*pa «ra«ra ;
}
a) ra
b) ra ra ra
c) Compiler error
d) None of these
,Q6. Out of the following which is a correct comment?
a) */ Comments */
b) ** Comment **
c) /* Comment */
d) { Comment }
Q7. What will be the output of the program if the array begins at 65486 and
each integer occupies 2 bytes?
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf(%u, %u , arr+1, &arr+1);
return 0;
}
a) 12, 65490
b) 14, 65492
c) 65488, 65496
d) 64490, 65498
ANS: c
Q8. What is the command to delete an index?
a) DROP index empno.empid
b) DELETE index empno.empid
c) REMOVE index empno.empid
d) None of the above
Q9. What is the terminator that is used to terminate C++ code?
, a) . (dot)
b) ; (semi-colon)
c) : (colon)
d) (single quote)
Q10. What will be the output of the program?
#include
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf(%d %d , k, l);
return 0;
}
int addmult(int ii, int jj);
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
a) Function addmult()return 7 and 12
b) No output
c) Error: Compile error
d) None of above
ANS: c
Q11. If int is 2 bytes wide, what will be the output of the program?
#include
void fun(char**);