Computers Aptitude
Comprehensive computer science aptitude quiz covering programming, hardware, data structures, algorithms, databases, networking, and digital logic fundamentals.
Questions
A name or number used to identify a storage location is called a/an
- byte
- record
- address
- constant
Which of the following is an open source software?
- Windows
- Macintosh
- Linux
- NetWare
Which computer memory is used for storing programs and data currently being processed by the CPU?
- Mass memory
- Internal memory
- Non-volatile memory
- PROM
The fields in a structure of a C program are by default
- protected
- public
- private
- static
The output that is obtained on the screen is called
- Hard copy
- Soft copy
- Print copy
- VDU
Offline device is
- a device which is not connected to CPU
- a device which is connected to CPU
- a direct access storage device
- an I/O device
Personnel who design, program, operate and maintain computer equipment refers to
- console-operator
- programmer
- people ware
- system analyst
The distinguishable parts of a record are called
- files
- data
- database
- fields
Which of the following is a computer program that converts an assembly language to machine language?
- Compiler
- Interpreter
- Assembler
- Comparator
What type of software is most useful in financial planning and calculation?
- Graphics
- Communication
- Database
- Spreadsheet
RAM is used as a short memory because it is/has
- volatile
- expensive
- small capacity
- programmable
Which command is used to copy a file in Unix?
- copy
- cp
- cpio
- tar
You can add a date to a document by
- inserting a text date
- inserting a date field that will update automatically
- typing date manually
- inserting a constant labeled date
C++ is a/an
- low level language
- machine language
- object oriented language
- assembly language
The first step in problem solving process is to
- plan the algorithm
- analyze the problem
- desk-check the algorithm
- code the algorithm
Which of the following control structures is used in every program?
- Repetition
- Selection
- Sequence
- Switching
The directives for the pre-processors begin with
- ampersand symbol (&)
- two slashes (//)
- hash symbol ( # )
- less than symbol ( < )
Which of the following is/are conditional operator(s)?
- Double Ampersand (&&)
- Double Pipeline (||)
- Question mark and colon (? :)
- Question mark (?)
Observe the following statements and decide what do they do:
string mystring;
getline(cin, mystring);
- reads a line of string from cin into mystring
- reads a line of string from mystring into cin
- cin cannot be used in this way
- Function declaration is wrong
The unique function in C++ program by where all C++ programs start their execution, is
- Start ( )
- Begin( )
- Main ( )
- Output( )
In case of arguments passed by values when calling a function such as
Z = addition (x,y),
- Any modifications to the variables x & y from inside the function will not have any effect outside the function.
- The variables x and y will be updated when any modification is done in the function.
- The variables x and y will be passed back to the function addition.
- The result of a function cannot be assigned to a variable Z.
What is the difference between x (x without quotes) and 'x' (x with quotes)?
- The first x refers to a variable and the second one 'x' refers to the character constant.
- The first x is a character constant and second one 'x' is the string literal.
- Both are same
- The first x is a character constant and second one 'x' is a pointer.
A class having no name
- is not allowed
- cannot have a constructor
- cannot have a destructor
- cannot be passed as an argument
Which of the following statements is true about pre-processor directives?
- These are lines read and processed by the preprocessor.
- They do not produce any code by themselves.
- These must be written within the main program.
- They end with a colon.
A variable is a
- string that varies during program execution
- portion of memory to store a determined value
- number that is frequently required in a program
- fixed value
Forgetting to include a header file like “math.h” will result in
- compilation error
- warning when the program is compiled
- warning when the program is executed
- error at link time
Which of the following is a selection statement in C++?
- Break
- Goto
- Exit
- Switch
In case of pass by reference
- the value of the variable is passed to the function so that it can manipulate it
- the location of variable in memory is passed to the function so that it can use the same memory area for its processing
- the value of the variable cannot be changed within the calling function
- the calling function cannot return the manipulated value
What is the output of the following code?
#include<stdio.h>
void main ( )
{
int s=0;
while (s++<10)
{
if(s<4&&s<9)
continue;
printf(“ %d/t”,s);
}
}
- 1 2 3 4 5 6 7 8 9
- 1 2 3 10
- 4 5 6 7 8 9 10
- 4 5 6 7 8 9
___________ is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.
- Class
- Inheritance
- Polymorphism
- Aggregation
The return data type of void means
- a void area in memory is returned so that you can populate it
- no data type is returned
- void is not a valid data type
- integer data type is returned
Array passed as an argument to a function is interpreted as
- address of the number of elements of the array
- values of the first elements of the array
- address of the first element of the array
- number of elements of the array
What happens when you try to assign a value larger than the maximum possible integer to an int variable in C++?
- The program terminates
- You get an overflow error
- The value becomes a negative value
- The value becomes zero
A class can have many methods with the same name, as long as the number of parameters is different. This is known as
- method overloading
- method invocating
- method overriding
- method labeling
Which of the following is not a limitation of binary search algorithm?
- It must use a sorted array.
- The requirement of sorted array is expensive when a lot of insertion and deletions are needed.
- There must be a mechanism to access middle element directly.
- The binary search algorithm is not efficient when the data elements are more than 1000.
Which of the following statements is the most appropriate regarding recursion?
- We should not use recursion because iteration is always more efficient.
- We write less code if we use iteration instead of recursion.
- Recursion is always the most efficient technique to solve problems.
- In recursion, we divide a problem into subtasks where one subtask can be a smaller version of the original problem.
Assume the following declarations in C++
int num [5] = {3, 4, 6, 2, 1} ;
int *p = num;
Which of the following is correct?
- num[1] is same as p+1
- num[2] is same as &(p+2)
- num[3] is same as *(p+3)
- num is same as *p
Select the proper object type in C++.
__________ file (“file. dat”, ios::in | ios::out)
- iostream
- fstream
- ofstream
- ifstream
Which two of the following statements are true about constructors?
I. A constructor has no return type and is therefore a void method.
II. A constructor has the same name as the class.
III. A class can have more than one constructor.
IV. Constructors are called like any other method.
- III and IV
- I and II
- II and III
- I and IV
Defining a class so that the implementation of the data and methods of the class are not known to the programmers who use the class is called
- data binding
- polymorphism
- encapsulation
- inheritance
Which data structure allows deleting data elements from front and inserting at rear ends?
- Stacks
- Queues
- Linked list
- Bubble sort
If Infix = (a + b) * (c - d) / (e + f) is the INFIX expression, then what will be its Postfix value in POSTFIX expression?
- Postfix = a b + c d * -e f + /
- Postfix = a b + c d - * e f + /
- Postfix = a b + c d - * / +
- Postfix = e f + a b + c d * - /
The operation for removing an entry from a stack is traditionally called
- delete
- peek
- pop
- remove
The memory address of fifth elements of an array can be calculated by the formula
- LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array
- LOC (Array[5]=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the array
- LOC(Array[5]=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the array
- LOC (Array[5]=Base(Array)+w(5-Upper bound), where w is the number of words per memory cell for the array
Who invented Boolean algebra?
- Von Neumann
- Donald E. Knuth
- George Boole
- Charles Babbage
In base 5, which number is equivalent to 1000 base-10?
- 12444
- 20024
- 10030
- 13000
If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?
- ABCD
- ABDC
- DCAB
- DCBA
A NOR gate is ON only when all its inputs are
- ON
- Positive
- High
- OFF
Which of the following Boolean expressions is always true?
- 10 <= x && !(x >= 10)
- y = = x + y && x = = x + y
- 10 <= x | | !( x >= 10)
- y = = x + y | | x = = x + y
The term 'baud' is a measure of
- speed at which data travels over the communication line
- memory capacity
- instruction execution time
- small initialization program to start up a computer
Find out the error in following block of code.
If (x = 100)
cCout << “x is 100” ;
- 100 should be enclosed in quotations.
- There is no semicolon at the end of first line.
- “Equals to” operator mistake.
- Variable x should not be inside the quotation.
In the context of open source technologies, what is the meaning of OSI and FSF acronyms/abbreviations?
- Open System Interconnection and Flight Safety Foundation
- Open System Interchange and Flight Safety Foundation
- Open Source Initiative and Free Software Foundation
- Open Source Instrument and Financial Stability Forum
Ethernet uses
- bus topology
- ring topology
- mesh topology
- star topology
Which of the following is an advantage of using fiber optics data transmission?
- Resistance to data theft
- Fast data transmission rate
- Low noise level
- All of above
Consider the following function:
void f(unsigned int n)
{
do {
putchar ('0' + (n % 10)) ;
} while (n /= 10) ;
putchar (' n') ;
}
What is the output of f(837)?
- 387
- 738
- 800
- 700
What does printf(“%d, %d ”, 5/3, 5 % 3) print to standard output?
- 1.66, 1 (That is, '1.66', a comma, a space, a '1', and a newline character)
- 1.6, 2 (That is, '1.6', a comma, a space, a '2', and a newline character)
- 1.666, 0 (That is, '1.666', a comma, a space, a '0', and a newline character)
- 1, 2 (That is, a '1', a comma, a space, a '2', and a newline character)
What is a 'tuple' in RDBMS?
- A row or record in a database table
- Another name for the key linking different tables in a database
- An attribute attached to a record
- Another name for a table in an RDBMS
A SELECT statement can be used to perform these three functions:
Choose rows from a table
Choose columns from a table
Bring together data that is stored in different tables by creating a link between them
Which set of keywords describes the above capabilities?
- Difference, projection, join
- Selection, projection, join
- Selection, intersection, join
- Intersection, projection, join
The K-map equation for following truth table is
| A | B | Y |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
- AB + A’B’
- A’B + AB’
- AB + AB’
- A’B + AB
What is “operator overloading”?
- To re-define built-in operators in a programming language (i.e. C++) to work with objects.
- An event that arises when a computer is overheated.
- A C++ program to process data in parallel.
- A strategy in C++ to avoid deadlock.