- What is the output of the following program ?
(Assume that the appropriate pre-processor directives are included and there is no syntax error)
main()
{
char S[ ] = “ABCDEFGH”;
printf (“%C”,* (& S[3]));
printf (“%s”, S+4);
printf (“%u”, S);
/* Base address of S is 1000 */ }
(A) ABCDEFGH1000 (B) CDEFGH1000
(C) DDEFGHH1000 (D) DEFGH1000
Answer: D
Explanation.
S[0]=A at address 1000.
S[1]=B at address 1001.
S[2]=C at address 1002.
S[3]=D. at address 1003.
S[4]=E. at address 1004.
S[5]=F
S[6]=G
S[7]=H.
printf(“%c”,*(&S[3])); prints character at subscript S[3].
printf(“%s”,S+4); prints from base address 1000+4.
printf(“%u”,S); prints base address.
- Which of the following, in C++, is inherited in a derived class from base class ?
(A) constructor (B) destructor
(C) data members (D) virtual methods
Answer: C
- Given that x=7.5, j=-1.0, n=1.0, m=2.0
the value of –x+j == x>n>=m is:
(A) 0 (B) 1
(C) 2 (D) 3
Answer: A
Explanation.
–(x)+-1.0==7.5>1>=2.
5.5==7.5>0 (as 1>=2 is false).
6.5==1.(as 7.5>0).
6.5==1 is false.
- Which of the following is incorrect in C++ ?
(A) When we write overloaded function we must code the function for each usage.
(B) When we write function template we code the function only once.
(C) It is difficult to debug macros
(D) Templates are more efficient than macros
Answer: D
- When the inheritance is private, the private methods in base class are……………… in the derived class (in C++).
(A) inaccessible (B) accessible
(C) protected (D) public
Answer: A
- An Assertion is a predicate expressing a condition we wish database to always satisfy. The correct syntax for Assertion is :
(A) CREATE ASSERTION ‘ASSERTION Name’ CHECK ‘Predicate’
(B) CREATE ASSERTION ‘ASSERTION NAME’
(C) CREATE ASSERTION, CHECK Predicate
(D) SELECT ASSERTION
Answer: A
Explanation.
- An assertion is a predicate expressing a condition we wish the database to always satisfy.
- Domain constraints, functional dependency and referential integrity are special forms of assertion.
- Where a constraint cannot be expressed in these forms, we use an assertion, e.g.
- Ensuring the sum of loan amounts for each branch is less than the sum of allaccount balances at the branch.
- Ensuring every loan customer keeps a minimum of $100 in an account.
- An assertion in DQL-92 takes the form,
- Which of the following concurrency protocol ensures both conflict serializability and freedom from deadlock ?
(a) 2-phase Locking
(b) Time stamp – ordering
(A) Both (a) and (b) (B) (a) only
(C) (b) only (D) Neither (a) nor (b)
Answer: C
- Drop Table cannot be used to drop a Table referenced by ……………… constraint.
(a) Primary key (b) Sub key (c) Super key (d) Foreign key
(A) (a) (B) (a), (b) and (c)
(C) (d) (D) (a) and (d)
Answer: C
- Database applications were built directly on top of file system to overcome the following drawbacks of using file-systems
(a) Data redundancy and inconsistency
(b) Difficulty in accessing Data
(c) Data isolation
(d) Integrity problems
(A) (a) (B) (a) and (d)
(C) (a), (b) and (c) (D) (a), (b), (c) and (d)
Answer: D
- For a weak entity set to be meaningful, it must be associated with another entity set in combination with some of their attribute values, is called as :
(A) Neighbour Set (B) Strong Entity Set
(C) Owner entity set (D) Weak Set
Answer: C