Sample Questions on Computer Science
Subjects
C Questions:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
What does static variable mean in C language?
What are the different storage classes in C?
What is a null pointer?
What is the difference between string and character arrays?
What is the difference between malloc() and calloc()?
Which bitwise operator is suitable to check whether a
particular bit is on or off? (AND)
Which bitwise operator is suitable for turning off a
particular bit in a number? (AND)
Which bitwise operator is suitable for turning on a
particular bit in a number? (OR)
What is preprocessor?
What is heap?
How do you use pointer to a function?
Write a program in C that displays hello world without
using semicolon(;).
What is the difference between const char *p and char const
*p?
How do you print an address in C?
What is recursion?
What is the difference between pass by value and pass by
reference?
Does there exist any other function which can be used to
convert an integer or a float to a string?
Write a program to find the Factorial of a number.
What is difference between Structure and Unions?
20. What is the maximum combined length of command line
arguments including the space between adjacent arguments?
C++ Questions:
1. What is a class?
2. What is an object?
3. What is the difference between class and object?
4. What is public, private and protected?
5. What are virtual functions?
6. What do you mean by pure virtual functions?
7. What is polymorphism?
8. What is dynamic polymorphism?
9. What is abstraction?
10. Does C++ support multilevel and multipleinheritance?
11. What do you mean by inline function?
12. What are the main differences between
procedure oriented languages and object
oriented languages?
13. What is RTTI?
14. What is the difference between delete and
destructor in C++?
15. What is function overloading and operator
overloading?
16. What are the differences between C and
C++? What are the advantages of C++ over
C?
17. What is the difference between copy
constructor and constructor?
18. What is realloc() and free()?
19. What is a Vector?
20. What is a scope resolution operator?
Java Questions:
1.
2.
3.
4.
5.
What is the difference between Java and C++?
Is Java fully object oriented?
What is an abstract class?
can the abstract class be final?
What is the difference between an abstract class and an
interface?
6. What are the different uses of static identifier in Java?
7. How is an object garbage collected in Java?
8. What are the uses of the final in Java?
9. What is the difference between finally and finalize() in Java?
10.What is the measure taken to prevent instance variable
hiding in Java?
11. Why does Java not support multiple
inheritance?
12.What is the difference between a process and a thread?
13.What is synchronization?
14.What are the wrapper classes present in Java?
15.What are different types of exceptions in Java?
16.What are checked exceptions and what are unchecked
exceptions?
17.What is the difference between array list and vector?
18.Which class is extended by all other classes in Java?
19.What happens when a thread acquire a lock on an object?
20. What is typecasting?What is upcasting?
Advanced Java Questions:
1. What is J2EE?What are the different tiers present in J2EE?
2. What are the different platforms provided by Sun Inc. for Java?
3. What is RMI? Explain RMI architecture.
4. What are servlets? Where is it used?
5. How servlets are different from Applets?
6. What is the API used in servlets?
7. What are the differences between RMI and CORBA?
8. How would you load an image into a servlet?
9. How will you pass values from htm page to the servlet?
10. What is the difference between CGI and servlet?
11. What is a container? Give example
12. What is request and response object and how they are used in
the web environment?
13. Explain the life cycle of a servlet.
14. How do you invoke a servlet? What is the difference between
doGet() and doPost() method?
15. What is bean?Where can it be used?
16. What is ODBC and JDBC? How do you connect to the
database?
17. What do you mean by socket programming?
18. What do you mean by COM and DCOM?
19. What are the implicit objects of JSP?
20. What is the basic difference between JSP,ASP and servlets?
Algorithm Questions:
1. What is the importance of algorithm in the field of Computer
Science?
2. List out the characteristics of algorithms.
3. Difference between searching and sorting
4. How do display the output as reverse of input, like input is
"This is a hat" and the output should be "hat a is This"?
5. What is meant by time complexity and space complexity?
6. What is the worst-case time complexity and best case time
complexity of the merge sort?
7. What is quick sort? perform quick sort on the following
numbers
20
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
40 50 15 10
05 80 90
What is the tower of Hanoi problem?
What is the Travelling Salesman problem?
What is minimum spanning tree?
What is dynamic programming? Examples
Which function grows faster?
n or logn
Nlogn or log nn
When a problem is said to be NP-complete?
When a problem is said to be NP hard? Give an
example of a NP-hard problem.
What is the time complexity of the kruskal and prims
algorithm?
What is the principle of Optimality?
What is the difference between the divide and conquer
and dynamic programming?
What is the 15-puzzle problem?
What is backtracking? Give an example of a problem
that implements backtracking.
20.
Justify that the merge sort tree associated with an
execution of merge sort on a sequence of size n has
height log n.
Data Structure Questions:
1. What is data structure?
2. What is ADT?
3. Convert the following infix expressions into their equivalent
postfix expressions:
i.
(A - B)*( D / E )
ii. (A + B D) / (E - F) +G
iii. (A + B) * (C $ (D - E) + F ) / G) $ (H - J)
4. How is it possible to insert different types of element in a
stack?
5. In which data structure elements can be added or removed at
either end but not in the middle?
6. What do you mean by syntax error, logical error, and runtime
error?
7. What is bubble sort?
8. What is quick sort?
9. What is the maximum total number of nodes in a tree that has
N levels? Note that the root is level (zero)?
10.
The element being searched for is not found in an array
of 100 elements. What is the average number of comparisons
needed in a sequential search to determine that the element is
not there, if the elements are completely unordered?
11.
What is the average number of comparisons needed in a
sequential search to determine the position of an
element in an array of 100 elements, if the elements are
ordered from largest to smallest?
12.
13.
14.
15.
16.
17.
18.
19.
20.
What is priority queue? What is circular queue?
What is B+ tree?
What is binary tree?
What is the average number of comparisons in
Sequential search?
Can we do binary search on a linked list?
Evaluate the following prefix expression
" ++ 26 + - 1324"
What is Tail recursion?
Which data structure is needed to convert infix notation
to postfix notation?
What is an AVL tree?
Networking Questions:
1. What is networking?
2. How many layers are there in networking?
3. What is a default gateway?
4. Explain the OSI model
5. What is the difference between repeater, router and bridge?
6. What is TCP/IP protocol?
7. What is RIP and what is its use?
8. What is the difference between TCP and UDP?
9. What is multi-layer switching?
10.
What is frame relay?
11.
What is LDAP?
12.
What is a firewall?
13.
What is IPv6 protocol?
14.
Name some routing protocols
15.
What is the difference between ARP and RARP?
16.
What is digital signature?
17.
What is the role of Single Sign On in authentication
technologies?
18.
How do you use RSA for both authentication and
19.
20.
secrecy?
What is WLAN?
What are the different network topologies?
Operating System Questions:
1. What are the basic functions of operating system?
2. Briefly explain the function of processor, assembler, compiler,
loader, and linker?
3. What is cache memory?
4. What are the different job scheduling techniques present in
the operating system?
5. What is a real-time system?
6. What is the difference between hard and soft real-time
system?
7. What is a mission critical system?
8. If two processes which shares same system memory and
system clock in a distributed system, what is it called?
9. What is the state of the processor, when a process is waiting
for some event to occur?
10. What do you mean by deadlock?
11. Explain the difference between microkernel and macro
kernel.
12. Give an example of microkernel.
13. Write a small dc shell script to find number of FF in the
design.
14. Why paging is used?
15. Which is the best page replacement algorithm and Why?
How much time is spent usually in each phases and why?
16. What is multi tasking, multi programming, multi threading?
17. Difference between multi threading and multi tasking?
18. Demand paging, page faults, replacement algorithms,
thrashing, etc.
19. Explain about paged segmentation and segment paging
20. While running DOS on a PC, which command would be used
to duplicate the entire diskette?
OS QUESTIONS
1. What is the main advantage of multiprogramming?
2. Describe the differences between symmetric and asymmetric
multiprocessing. What are three advantages and one
disadvantage of multiprocessor systems?
3. What is the purpose of the resident monitor?
4. What is spooling?
5. What are the five major activities of an operating system in
regard to file management?
6. What is the purpose of system calls?
7. Describe the differences among short-term, medium-term,
and long-term scheduling.
8. What is the degree of multiprogramming?
9. What is a PCB?
10.
What is a context switch?
11.
What is the convoy effect?
12.
What is aging?
13.
What is the meaning of the term busy waiting? What
other kinds of waiting are there? Can
14.
busy waiting be avoided altogether? Explain your
answer.
15.
Explain the concept of transaction atomicity.
16.
What three requirements must a solution to the criticalsection problem satisfy?
17.
Give examples of sharable resources.
18.
List two ways we can break the second condition to
prevent deadlock.
19.
What are page protection bits?
20.
What is reentrant code?
21.
How do global and local allocation differ?
NETWORKING QUESTIONS
1. What is a peer-to-peer process?
2. What are the three major classes of guided media?
3. Compare and contrast a random access protocol with a
controlled access protocol.
4. What is the difference between a BSS and an ESS?
5. What is a transparent bridge?
6. How is a repeater different from an amplifier?
7. What is the purpose of RIP?
8. What is the difference between a direct and an indirect
delivery?
9. What is an FQDN? What is a PQDN? What is a zone?
10.
What is anonymous FTP?
11.
What is MIME?
12.
What are the three FTP transmission modes?
13.
What is the relationship between a switch and a bridge?
14.
What is the purpose of an NIC?
15. Why is there no need for CSMA/CD on a full-duplex
Ethernet LAN?
16.
What is NAT? How can NAT help in address
depletion?
17.
What is the number of bits in an IPv4 address? What is
the number of bits in an IPv6 address?
18.
What are the differences between classful addressing
and classless addressing in IPv4?
19.
What is the difference between local and remote log-in
in TELNET?
20.
Are both UDP and IP unreliable to the same degree?
Why or why not?
21.
What is traffic shaping? Name two methods to shape
traffic.
DATABASE MANAGEMENT SYSTEM
1. What is physical data independence?
2. Define candidate key.
3. Define cardinality of a relation.
4. what is formula?
5. Define transaction.
6. What is lossless-join?
7. What is meant by pipelined parallelism?
8. What is data skew?
9. What is trigger? How do you create it?
10.
What is multivalued dependency?
11.
What are the basic steps in implementing a database
management system?
12.
What do you mean by datamart and datawarehouse?
13.
What is a referential integrity constraint?
14.
An index has an index entry for every search key value
in the data file is called
a. Sparse index
b. Dense index
c. (a) and (b) both
d. None of these
15.
If records of a file are physically on a nonkey fieldwhich does not have a distinct value for each record is called
a. Primary index
b. Clustering index
c. Secondary index
d. None of these
16.
Ordering of a records of a file on disk based on the
values of one of their fields.The file is called
a.
b.
c.
d.
17.
in
a.
b.
c.
d.
Sequential file
Heap file
Hash file
Any of the above
The file blocks are allocated to consecutive disk blocks
Contiguous allocation
Linked allocation
(a) and (b) both
None of these
18.
The file records one of the same record type but one or
more fields may be multiple values for individual records
;such a field is called
a. Variable length field
b. Optional field
c. Repeating field
d. None of the above
19.
a.
b.
c.
d.
Data is usually stored in the form of
Records
Fields
Values
None of these
20.
The time required to transfer a disk block, given its
address, the disk controller must 1st mechanically position
the read/write head on the current block is called
a.
b.
c.
d.
Block transfer time
Rotational time
Seek time
None of these
21.
The constraint specifies that every entity in the
superclass must be a member of some subclass in the
specialization
a. Total specialization
b. Partial specialization
c. Both (a) and (b)
d. None of these
22.
The process of defining a generalized entity type from a
given entity type is called
a. Specialization
b. Generalization
c. None of these
d. Can be used
23.
The language is used by the DBA & by database
designer to define both schemes
a. DML
b. SDL
c. VDL
d. DDL
24.
The DBMS must include a s/w to ensure that several
users trying to update the same data to do so in a controlled
manner so that the result of the update is correct
a. Concurrency control
b. Redundancy control
c. Synchronization
d. None of the above
25.
Access to the disk is controlled primarily by which
schedules disk input/output
a. Database Manager
b. Database Administrator
c. Operating System
d. None of these
26.
The entity type that do not have key attribute of their
own are called
a. Regular entity type
b. Identifying entity type
c. Weak entity type
d. Strong entity type
27.
The key which is the set of attributes that can uniquely
identify weak entities that are related to the same owner
entity
a. Partial key
b. Primary key
c. Key attribute
d. None of these
28.
In secondary index we would have to do on the data file
if the secondary index did not exist
a. Linear search
b. Binary search
c. Both (a) and (b)
d. None of these
29.
For primary index , we could still use on the main file ,
even if the index did not exist
a. Binary search
b. Linear search
c. Both (a) and (b)
d. None of these
30.
The _________ of a relation is the no of attributes of its
relation schema
a. Attribute
b. Degree
c. Domain
d. None of these
31.
In relational model , a set of (<attribute>,<value>)
pairs, is considered as
a. Tuple
b. Entity
c. Relation
d. None of these
32.
The key whose values are used to identify tuples in the
relation is called
a. Candidate key
b. Primary key
c. Foreign key
d. Super key
33.
The integrity constraint states that no primary key value
can be null is called
a. Entity
b. Relational
c. Foreign key
d. Semantic
34.
The result of the operation that includes all tuples that
are either in R or in S or in both R & S is called
a. SET DIFFERENCE
b. INTERSECTION
c. UNION
d. None of these
35.
The concept of foreign keys are in the integrity
constraint
a. Entity
b. Referential
c. Semantic
d. Transaction
36.
a.
b.
c.
d.
The symbol '*' is used to denote
JOIN
EQUI JOIN
NATURAL JOIN
None of these
37.
a.
b.
c.
d.
The operation (R U S) - ((R - S) U (S - R)) is known as
UNION
RENAME
INTERSECTION
CARTESIAN PRODUCT
38.
a.
b.
c.
d.
To remove the database schema, we use the command
DROP TABLE
REMOVE TABLE
REMOVE SCHEMA
DROP SCHEMA
39.
To add an attribute to an exiting base relation in a
schema , we use the command
a. CREATE
b. ALTER
c. SELECT
d. INSERT
40.
a.
b.
c.
d.
EXISTS is used in
Correlated nested query
Nested query
Outer query
None of these
41.
To retrieve all attributes we use the symbol SELECT
_____
a. +
b.
c. *
d. /
42.
When we use locking , the problem occures when a
transaction can not proceed for an indefinite period of time
while other transactions in the system continue normally
a. Starvation
b. Transaction
c. Time out
d. None of these
43.
To order the tuples by the values of one or more
attributes, the clause used is
a. ORDER BY
b. BY ORDER
c. GROUP BY
d. HAVING
44.
The inner query is evaluated once for each tuple in the
outer query
a. Nested query
b. Outer query
c. Correlated nested query
d. None of these
45.
If we attempt a natural join operation on two tables,the
result produces many more tuples than original tuples.This
tuples are called
a. Spurious tuple
b. Dangling tuples
c. Functional dependency
d. All of these
46.
Which normal form is based on the concept of full
functional dependency?
a. 1NF
b. 3NF
c. 2NF
d. 4NF
47.
A relation schema R is in which normal form if every
nonprime attribute A in R is not partially dependent on any
key of R.
a. 1NF
b. 2NF
c. 3NF
d. 4NF
48.
A logical unit of database processing that includes one
or more database access operations is called
a. Transaction
b. Concurrency control
c. Recovery
d. None of these
49.
The operation that signals that the transaction has ended
unsuccessfully, so that any changes or effects that the
transaction may have applied to the database must be undone
a. ROLLBACK
b. ABORT
c. COMMIT_TRANSACTION
d. Both (a) and (b)
50.
A transaction can go to the state if one of the checks
fails or if the transaction is aborted during its active state is
called
a. Committed state
b. Partially committed state
c. Failed state
d. Terminated state
FORMAL LANGUAGE AND AUTOMATA
THEORY
1. Define the term Automata and name the various types of
languages accepted by an Automata.
2. Find the language generated by Grammer.
S ~ OSl/OAl, A ~ lA/I
3. What do you mean by ambiguity of a Grammer?
4. Define the terms canonical Derivation and context sensitivity
in the context of Derivation languages.
5. What is a regular Grammer?
6. Differentiate between leftmost and rightmost derivation trees.
7. Describe the retation between linear bounded Automata and
context sensitive Grammer.