











0Notifications Mark All Read
No New notification
- Login
- Get Prime
Computer Science Questions
ZS Associates Questions asked in Computer Science Section
Questions asked in ZS associates for the Computer Science Section can be found out on this page.
There will be total 10 questions and the time will be shared with other sections of the test.


ZS Associates Computer Science Papers
1. Use the following query to answer:
SELECT empno, e.deptno, dname, salary
FROM emp e, dept d
WHERE e.deptno = d.deptno;
Which of the following SQL statement is equivalent to the above query’?
Select your answer from below-
SELECT empno, deptno, dname, salary FROM emp e JOIN dept d ON e.deptno = d.deptno:
SELECT empno, deptno, dname, salary FROM emp JOIN dept USING (e.deptno, d.deptno);
SELECT empno, deptno, dname, salary FROM emp NATURAL JOIN dept:
SELECT empno, deptno, dname, salary FROMemp WHERE deptno IN (SELECT deptno FROM dept);
Solution: We need to do a join to extract data from both the tables. For this, we also have to out the condition of e.deptno = d.deptno.
Correct answer is a.
2. In SOL. group functions operate on
sets of rows to give one result per group.
selected columns.
operates on multiple tables.
none of the listed options
Solution: The SOL group functions operate on sets of rows to give one result per group.
Correct answer is: a.
3. Find the virtual functions present in the given code.
#include <iostream>
using namespace std:
class Student
{
public: virtual void display() {
cout « “Student”;
}
};
class CompScStud : public Student
public void display() {
cout « “Computer Science student”;
}
};
void main()
{ student *s:
S=new CompScStud();
S->display();
}
};
display() function defined in base class Student
display() function defined in derived class CompScStud
display function defined in base class as well as derived class
None of the listed options
Correct option is: A.
Solution: Virtual functions are always present in the base class.
4. Which of the statements about operator overloading is true in C++ language,
An overloaded operator can be defined as a friend of a class member.
Overloaded operator cannot be defined as a friend of a class or it must be the class member.
Operator must be defined as a friend of a class and cannot be a class member
Overloaded operator is not defined as a function.
Correct answer is: D
Solution: Operators and functions are different entities, and operator cannot be defined as a friend.
5. Use the following SQL query to answer:
WHERE deptno=10 and sal< ANY (select max (sal)
From emp
Where ename LIKE ‘%A%’);
Which of the following appropriate options can be used to complete the above query to modify the employees salaries by adding 2000 to it?
Select your answer from below:
Modify emp sal=sal+2000
Attach emp set sal=sal+2000
Update emp set sal=sal+2000
Add emp sal to sal=sal+2000
Correct answer is: C.
Solution: SQL uses the keyword Update a value in the table.
6. Data modelling entities usually have one or more of which of the following?
Sub entities
Keys
Relations
Synonyms
Correct answer is: A
Solution: The entities of a data model has sub entities.
7. Which of the following statements is true with respect to the given code?
class Book {
int bookID:
public:
Book(int i)
{
bookID =i;
cout <,Book ID = bookID;
}
};
void main() Book Cormp(10):
Select your answer from below:
The constructor with single argument Is executed 10 times with the value of the argument = 0
A runtime error occurs
The default constructor is executed 10 times
A compilation error occurs since the class Book does not have a default constructor
8. The data structure that can be used to check if an expression has matching opening or closing parentheses is
Queue
List Hash
Table
Stack
Correct answer is: D
Solution: Stack is used to check to check matching parenthesis.
9. Which of the commands identify the category of DDL commands,
CREATE. ALTER. DELETE
INSERT. UPDATE. DELETE
CREATE. UPDATE. DROP
CREATE. ALTER. DROP
Correct answer is: C
Solution: The DDL commands can create, update and drop a table from a database.
10. Which of the statement is not true about primary key,
It Is a unique Identifier for the table
It is a unique identifier for the table.
It is key which allows null records
it is a key attribute to identify the non-key attributes
Correct answer is: C
Solution: The primary key does not allow null records.
11. Which of the following statements are true with respect to access specifiers?
(i) Private members are not available outside the class
(II) Protected members are not available outside the class
(III) Public numbers are not available outside the Gass
(I) only
(II) only
(III) only
(IV) only
Correct answer is: A
Solution: The private members cannot be accessed outside of the class.
12. How many comparisons are required to sort the given set of elements 1, 2, 3, 4, and 5 using the insertion sort technique?
10
5
4
2
Correct answer is: A
Solution: It will take every element to compare its value with the element at its left. Therefore, the total comparisons will be 10.
13. Which of following operators cannot be overloaded?
i) Scope resolution operator denoted by ::
(II) Member access operator or the dot operator denoted by .
IlI) Conditional operator denoted by ?:
(iv) Pointer to member operator denoted by ,*
I AND II ONLY
I ,II,IV ONLY
I ,III,IV ONLY
I ,II,III,IV ONLY
Correct answer is: D.
Solution: All the above mentioned operators cannot be overloaded.
14. Which of the statement is true about full outer join,
Retrieves on, matching records from the Joining tables
Retrieves both matching as well as unmatched records from the Joining tables
Retrieves unmatched records from left table
Retrieves unmatched and matching records from right table
Correct answer is: B
Solution: It is used to retrieve both matched as well as unmatched data by joining tables.
15. For the C++ code given below, what will be the output?
#include <iostream>
#include <string>
Using namespace std;
Class order
{
Private: int orderID;
String orderDesrciption;
Public
Order () {orderID = 100;}
Order(int ID, string orderDesrciption= “”) {orderID= ID;}
Order (int ID) {orderID = ID;}
Int getOrderID() {return orderID;}
};
Class LocalOrder; public Order
{
Public LocalOrder(); Order(10){}
};
Void main()
{
Order “o = new LocalOrder;
Cout << o->getOrderID();
}
Select your answer from below:
Compilation error, since a class constructor must be defined outside the class
Compilation error, since a class cannot have constructor with default arguments
Compilation error, since a class can have only one constructor.
Compilation error, since there is an ambiguous call to overloaded constructor.
Solution: Since there is an ambiguous call to the overloaded constructor, it will show compilation error.
Correct answer is: d.
16. For the below C++ code, what will be the output?
Class Account
{
Private:
Int accNo;
Public:
Void SetAccount (int accNo)
{
AccNo = accNo;
}
Void Display()
{
Cout << accNo;
}
};
Int main()
{
Account a1;
A1. SetAccount(1001);
A1.Display();
Return 0;
}
Select your answer from below:
1001
Compilation error
Garbage value
Runtime Error
Correct answer is: d
Solution: As the object created is a1, but the object that calls the member function is A1.
17. PRODUCT
———————–
———————-
Product ID
Product description
Manufacturer ID
MANUFACTURER
——-
——–
Manufacturer ID
Manufacturer Name
You are running a query against a relational database.
Referring to the scenario above, what clause or command do you use in the query for faster retrieval of data?
GROUP BY clause
INDEX command
Having Clause
FROM clause
Correct answer: Option b
Solution: We will be using index command as it creates an entry for each value allowing faster retrieval of records from the table.
18. Which of the following are the disadvantages of a linear queue implemented as an array?
1) A stage may arrive when both front and rear are equal and point to the last location of the array i.e the queue is full since rear>=n-1 as well as empty since front=rear.
2) At a given time, all the locations to the left of the front are always vacant and unutilized.
(I) only
(II) only
Both (I) and (II)
Neither (I) and (II)
Correct answer: Option a
Solution: As one dimensional array of specific size use FIFO (First In First Out) principle to insert or delete the values into that array with the help of variables ‘front’ and ‘rear’.
Login/Signup to comment