1. Given a square matrix which consists only of 1 and 0. Find which rows, which cols and which diagonals consist entirely of 1's.
2. Given an array of integers find all possible combinations of the numbers whose sum equal to 90.
Ans : Knapsack problem
3. const int MAX=10;
main()
{
enum a {a,b,MAX};
print MAX;
}
ans. 2
4. Enum variable is a const variable which can only be assigned a value at initialization or a non const variable which can be assigned any value in the
middle of the program?
Ans. const variable
5. void *p;
What operation cannot be performed on p?
Ans : Arithmetic operation unless it is properly typecasted
6. char **p="Hello";
print p,*p,**p
Ans. Hello (null)
warning: suspicious pointer conversion
7. main()
{
char str[]="Geneius";
print (str);
}
print(char *s)
{
if(*s)
print(++s);
printf("%c",*s);
}
ans. suiene
8. What does the function fcloseall() does ?
ans. fcloseall() closes all open streams except stdin,stdout,stderr,stdprn and stdaux
9. main()
{ printf("Genius %d",fun(123));
}
fun(int n)
{ return (printf("%d",n));
}
Ans. 123genius3
10. Difference between definition and declaration.
Ans. Definition once while declaration more than once
11. find the error?
main()
{
void fun();
fun();
}
void fun()
{ int i=10;
if(i<10)
return 2.0;
return 3.0;
}
Ans. No error but warning
12. int a=9,b=5,c=3,d;
d=(b-c)<(c-a) ? a : b;
print d
Ans 5
13. 1+2/3*4+1=?
Ans. 2
14. In C++, a variable can be defined Wherever needed Whereas not in C
15. main()
{ int i=4;
fun(i=i/4);
print i;
}
fun(int i)
{ return i/2;
}
Ans 1
16. What is an array ?
Ans. contiguous collection of memory occupied by similar data types
17. printf(""NITK %%SURAHKAL%% !"");
Ans. "NITK %SURATHKAL% !"
18. Difference between scanf and gets in case of string input
Ans. scanf does not accepts white space while gets does
19. table t1 m rows and x cols
table t2 and rows and y cols
in t1*t2 rows? cols=?
Ans. m*n ,x+y
20. Symbol of relationship between 2 entities?
21. Which one cannot come in data modelling
a. customer
b. student
c. office
d. speed
Ans speed
22. Can a database table exist without a primary key ?
23. Whether higher normal forms better than lower forms as far redundancy is concerned ?
Ans. Higher
24. File is at which level
Ans. Conceptual level
25. What is a foreign key
Ans. Primary key in some other table