Wednesday, 25 January 2012

Basics of C++ - Objective Questions (MCQs) Set - 5

Questions


Question 1


Streams are
a.       Abstraction to perform input and output operations in sequential media
b.      Abstraction to perform input and output operations in direct access media
c.       Objects  where a program can either insert or extract characters to and from it
d.      Both a and c

Question 2


Which of the following is known as insertion operator?
a.       ^
b.      v
c.       << 
d.      >> 

Question 3:


Regarding the use of  new line character (/n) and endl manipulator with cout statement
a.       Both ways are exactly same
b.      Both are similar but endl additionally performs flushing of buffer
c.       endl can’t be used with cout
d.      \n can’t be used with cout

Question 4:


Which of the following is output statement in C++?
a.       print
b.      write
c.       cout
d.      cin

Question 5:


Which of the following is input statement in C++?
a.       cin
b.      input
c.       get
d.      none of above 

Question 6:


By default, the standard output device for C++ programs is
a.       Printer
b.      Monitor
c.       Modem
d.      Disk

Question 7:


By default, the standard input device for C++ program is
a.       Keyboard
b.      Mouse
c.       Scanner
d.      None of these

Question 8:


Which of the following statement is true regarding cin statement?
a.       cin statement must contain a variable preceded by >> operator
b.      cin does not process the input until user presses RETURN key
c.       you can use more than one datum input from user by using cin
d.      all of above

Question 9:


Which of the following is extraction operator in C++?
a.       ^
b.      v
c.       << 
d.      >> 

Question 10:


When requesting multiple datum, user must separate each by using
a.       a space
b.      a tab character
c.       a new line character
d.      all of abov


Answers



1.       d. Both a and c
2.       c. <<
3.       b. Both are similar but endl additionally performs flushing of buffer
4.       c. Cout
5.       a. Cin
6.       b. Monitor
7.       a. Keyboard
8.       d. All of above
9.       d. >>
10.   d. all of above

Basics of C++ - Objective Questions (MCQs)

Question 1:

 
cin extraction stops execution as soon as it finds any blank space character
 
a.       true
b.      false
 

Question 2:

 
Observe the following statements and decide what do they do.
 
string mystring;
 
getline(cin, mystring);
 
a.       reads a line of string from cin into mystring
b.      reads a line of string from mystring into cin
c.       cin can’t be used this way
d.      none of above
 

Question 3:

 
Regarding stringstream identify the invalid statement
 
a.       stringstream is defined in the header file <sstream>
b.      It allows string based objects treated as stream
c.       It is especially useful to convert strings to numerical values and vice versa.
d.      None of above
 

Question 4:

 
Which of the header file must be included to use stringstream?
 
a.       <iostream>
b.      <string>
c.       <sstring>
d.      <sstream>
 

Question 5:

 
Which of the following header file does not exist?
 
a.       <iostream>
b.      <string>
c.       <sstring>
d.      <sstream>
 

Question 6:

 
If you use same variable for two getline statements
 
a.       Both the inputs are stored in that variable
b.      The second input overwrites the first one
c.       The second input attempt fails since the variable already got its value
d.      You can not use same variable for two getline statements
 
 

Question 7:

 
The “return 0;” statement in main function indicates
 
a.       The program did nothing; completed 0 tasks
b.      The program worked as expected without any errors during its execution
c.        not to end the program yet.
d.      None of above
 

Question 8:

 
Which of the following is not a reserve keyword in C++?
 
a.       mutable
b.      default
c.       readable
d.      volatile
 

Question 9:

 
The size of following variable is not 4 bytes in 32 bit systems
 
a.       int
b.      long int
c.       short int
d.      float
 

Question 10:

 
Identify the correct statement regarding scope of variables
 
a.       Global variables are declared in a separate file and accessible from any program.
b.      Local variables are declared inside a function and accessible within the function only.
c.       Global variables are declared inside a function and accessible from anywhere in program.
d.      Local variables are declared in the main body of the program and accessible only from functions.



Answers



1.       a. True
2.       a. Reads a line of string from cin into mystring
3.       d. None of above
4.       d. <sstream>
5.       c. <sstring>
6.       b. The second input overwrites the first one
7.       b. The program worked as expected without any errors during its execution
8.       c. readable
9.       c. short int
10      b. Local variables are declared inside a function and accessible within the function on

Basics of C++ - Objective Questions (MCQs)

Question 1:

Find out the error in following block of code.
If (x = 100)
    Cout << “x is 100”;
a.       100 should be enclosed in quotations
b.      There is no semicolon at the end of first line
c.       Equals to operator mistake
d.      Variable x should not be inside quotation

Question 2:

Looping in a program means
a.       Jumping to the specified branch of program
b.      Repeat the specified lines of code
c.       Both of above
d.      None of above

Question 3:

The difference between while structure and do structure for looping is
a.       In while statement the condition is tested at the end of first iteration
b.      In do structure the condition is tested at the beginning of first iteration
c.       The do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not
d.      In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop

Question 4:

Which of the following is not a looping statement in C?
a.       while
b.      until
c.       do
d.      for

Question 5:

Which of the following is not a jump statement in C++?
a.       break
b.      goto
c.       exit
d.      switch

Question 6:

Which of the following is selection statement in C++?
a.       break
b.      goto
c.       exit
d.      switch

Question 7:

The continue statement
a.       resumes the program if it is hanged
b.      resumes the program if it was break was applied
c.       skips the rest of the loop in current iteration
d.      all of above

Question 8:

Consider the following two pieces of codes and choose the best answer

Code 1:

switch (x) {
case  1:
cout <<”x is 1”;
break;
case 2:
                cout <<”x is 2”;
                break;
default:
                cout <<”value of x unknown”;
}

Code 2

If (x==1){
                Cout <<”x is 1”;
                }
Else if (x==2){
                Cout << “x is 2”;
                }
Else{
                Cout <<”value of x unknown”;
}             

a.       Both of the above code fragments have the same behaviour
b.      Both of the above code fragments produce different effects
c.       The first code produces more results than second
d.      The second code produces more results than first.

Question 9:

Observe the following block of code and determine what happens when x=2?
switch (x){
case 1:
case 2:
case 3:
                cout<< "x is 3, so jumping to third branch";
                goto thirdBranch;
default:
                cout<<"x is not within the range, so need to say Thank You!";
                }

a.       Program jumps to the end of switch statement since there is nothing to do for x=2
b.      The code inside default will run since there is no task for x=2, so, default task is run
c.       Will display x is 3, so jumping to third branch and jumps to thirdBranch.
d.      None of above

Question 10

Which of the following is false for switch statement in C++?
a.       It uses labels instead of blocks
b.      we need to put break statement at the end of the group of statement of a condition
c.       we can put range for case such as case 1..3
d.      None of above


Answers


 
1.       c. Equals to operator mistake
2.       b. Repeat the specified lines of code
3.       In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop
4.       b. Until
5.       d. Switch
6.       d. Switch
7.       c. skips the rest of the loop in current iteration
8.       a. Both of the above code fragments have the same behaviour
9.       c. Will display x is 3, so jumping to third branch and jumps to thirdBranch
10.   c. we can put range for case such as case 1..3

Basics of C++ - Objective Questions (MCQs)

Question 1:

The void specifier is used if a function does not have return type.
a.       True
b.      False

Question 2:

You must specify void in parameters if a function does not have any arguments.
a.       True
b.      False

Question 3:

Type specifier is optional when declaring a function
a.       True
b.      False

Question 4:

Study the following piece of code and choose the best answer
int x=5, y=3, z;
a=addition(x,y)
a.       The function addition is called by passing the values
b.      The function addition is called by passing reference

Question 5:

In case of arguments passed by values when calling a function such as z=addidion(x,y),
a.       Any modifications to the variables x & y from inside the function will not have any effect outside the function.
b.      The variables x and y will be updated when any modification is done in the function
c.       The variables x and y are passed to the function addition
d.      None of above are valid.

Question 6:

If the type specifier of parameters of a function is followed by an ampersand (&Wink, that function call is
a.       pass by value
b.      pass by reference

Question 7:

In case of pass by reference
a.       The values of those variables are passed to the function so that it can manipulate them
b.      The location of variable in memory is passed to the function so that it can use the same memory area for its processing
c.       The function declaration should contain ampersand (& in its type declaration
d.      All of above

Question 8:

Overloaded functions are
a.       Very long functions that can hardly run
b.      One function containing another one or more functions inside it.
c.       Two or more functions with the same name but different number of parameters or type.
d.      None of above

Question 9:

Functions can be declared with default values in parameters. We use default keyword to specify the value of such parameters.
a.       True
b.      False

Question 10:

Examine the following program and determine the output
#include <iostream>
using namespace std;
int operate (int a, int b)
{
                return (a * b);
}
float operate (float a, float b)
{
                return (a/b);
}
int main()
{
                int x=5, y=2;
                float n=5.0, m=2.0;
                cout << operate(x,y) <<"\t";
cout << operate (n,m);
return 0;
}

a.       10.0      5.0
b.      5.0         2.5
c.       10.0      5
d.      10         2.5



Answers



1.       a. True
2.       b. False  [ parameters can be empty without void too!]
3.       b. False
4.       a. The function addition is called by passing the values
5.       a. Any modifications to the variables x & y from inside the function will not have any effect outside the function
6.       b. pass by reference
7.       b. The location of variable in memory is passed to the function so that it can use the same memory area for its processing
8.       d. None of above
9.       b. False
10.    d. 10       2.5

Basics of C++ - Objective Questions (MCQs) Set - 1

Questions


Question 1.

What is the correct value to return to the operating system upon the successful completion of a program?
A. -1
B. 1
C. 0
D. Programs do not return a value.

Question 2.

What is the only function all C++ programs must contain?
A. start()
B. system()
C. main()
D. program()

Question 3.

What punctuation is used to signal the beginning and end of code blocks?
A. { }
B. -> and <-
C. BEGIN and END
D. ( and )

Question 4.

What punctuation ends most lines of C++ code?
A. . (dot)
B. ; (semi-colon)
C. : (colon)
D. ' (single quote)

Question 5.

Which of the following is a correct comment?
A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }

Question 6.

Which of the following is not a correct variable type?
A. float
B. real
C. int
D. double

Question 7.

Which of the following is the correct operator to compare two variables?
A. :=
B. =
C. equal
D. ==

Question 8.

Which of the following is true?
A. 1
B. 66
C. .1
D. -1
E. All of the above

Question 9.

Which of the following is the boolean operator for logical-and?
A. &
B. &&
C. |
D. |&

Question 10.

Evaluate !(1 && !(0 || 1)).
A. True
B. False
C. Unevaluatable



Answers


1. C. 0
2. C. main()
3. A. { }
4. B. ;
5. C. /* Comment */
6. B. real
7. D. ==
8. E. All of the above
9. B. &&
10. A. True

Programming Languages and Language Processors Set MCQ

Programming Languages and Language Processors Set 1.


Questions

Question 1:

Electronic spreadsheets are most useful in a situation where relatively .... data must be input but ...... calculations are requied.
a. little; simple
b. large; simple
c. large; complex
d. little; complex

Question 2:

The two basic types of record access methods are
a. sequential and randon
b. direct and immediate
c. sequential and indexed
d. on-line and real-time
e. none of above

Question 3:

Which file organization is allowed by a direct access storage device?
a. direct only
b. sequential and direct only
c. indexed and direct only
d. sequential, indexed and direct
e. none of above

Question 4:

Sequential file organization is most appropriate for which of following applications?
a. Grocery store checkout
b. bank checking account
c. payroll
d. airline reservations
e. none of above

Question 5:

Which of the following file organization is most effieient for a file with a high degree of file activity?
a. sequential
b. ISAM
c. VSAM
d. B-Tree
e. All of above

Question 6:

One disadvantage of a direct access file is:
a. the delay in computiong the storage address
b. duplication of address locations
c. unsued, but available, storage locations
d. all of above

Question 7:

All computers execute
a. BASIC programs
b. COBOL programs
c. Machine language program
d. FORTRAN programs
e. PL/1 programs

Question 8:

Which of the following is most oriented to scientific programming?
a. FORTRAN
b. COBOL
c. BASIC
d. PL/1
e. RPG

Question 9:

All of the following are disadvantage of RPG except:
a. it is a very machine dependent language
b. it is very limited in scope
c. is not suited for complex problems requiring extensive programming logic
d. it has larger storage requierments
e. all of the above are disadvantages

Question 10:

Which of the following is not one of the process that a high level language program msut go through before it is ready to be executed?
a. translation
b. controlling
c. lading
d. linking
e. all of the above are necessary process

Answers:

1. d     2. a     3. d     4. c     5. a     6. a     7. c   8. a     9. b.     10.a

Programming Languages and Language Processors Set MCQ

Programming Languages and Language Processors Set 2.


Questions

Question 1:

Which of the following is not true of FORTRAN?
a. it was developed for scientific and mathematical applications
b. it is one of the oldest high-level languages
c. it is a problem oriented language
d. it requires extensive internal documentation
e. all of above

Question 2:

All of the following are divisions of the COBOL program except:
a. input-output
b. indentification
c. procedure
d. data
e. all of above divisions

Question 3:

In a COBOL program, the input output section is within the .... division
a. identification
b. procedure
c. configuration
d. environment
e. none of above

Question 4:

Which of hte following is not characteristic of COBOL
a. it is a very standardized language
b. it is a very efficient in terms of coding and execution
c. it has limited facilities for mathematical notation
d. it is very readable language
e. all of the above are characteristics

Question 5:

Which of the following is an example of problem oriented language?
a. BASIC
b. PL/1
c. FORTRAN
d. All of above
e. none of above

Question 6:

In the evaluation of a computer language, all of the following characteristics should be considered except?
a. application oriented features
b. efficiency
c. readability
d. softare development aids
e. hardware maintainance costs

Question 7:

A factor in the selection of a source language is
a. programmer skill
b. language availability
c. program compatibility with other software
d. all of athe above

Question 8:

A computer generated output that lets programmer follow the execution of their programs line by line is a
a. core dump
b. trace routine
c. detail listing
d. source listing

Question 9:

In BASIC, description comments are put in the source program with the
a. PRINT statement
b. REMARK statement
c. INPUT statement
d. DATA statement

Question 10:

Which of the following generations of language will likely include the languages of the featuer?
a. first generation
b. second dgeneration or third generation
c. fourth generation
d. fifth generation

Answers:

1. b       2.a       3.d       4.b       5.d       6.e       7.d      8.b       9.b       10.c

Database Management System and Design MCQ Set 1

Database Management System and Design MCQ Set 1

Questions

Questions 1:

The ascending order of a data hirerchy is:
a. bit-byte-record-field-file-database
b. byte-bit-field-record-file-database
c. bit-byte-field-record-file-database
d. bit-byte-file-record-field-database

Question 2:

Which of the following is true of a network structure?
a. t is a physical representation of the data
b. It allows a many-to-many relationship
c. It is conceptually simple
d. It will be dominant data base of the future

Question 3:

Which of the following is a problem of file management system?
a. difficult to update
b. lack of data independence
c. data redundancy
d. program dependence
e. all of above

Question 4:

One data dictionery software package is called
a. DB/DC dictionary
b. TOTAL
c. ACCESS
d. Datapac
e. Data Manager

Question 5:

The function of a database is ...
a. to check all input data
b. to check all spelling
c. to collect and organize input data
d. to output data

Question 6:

What is the language used by most of the DBMSs for helping their users to access data?
a. High level language
b. SQL
c. Query Language
d. 4GL

Question 7:

The model for a record management system might be
a. handwritten list
b. a Rolodex card file
c. a business form
d. all of above

Question 8:

Primitive operations common to all record management system include
a. print
b. sort
c. look-up
d. all of above

Question 9:

In a large DBMS
a. each user can "see" only a small part of the entire database
b. each subschema contains every field in the logical schema
c. each user can access every subschema

Question 10:

Information can be transferred between the DBMS and a
a. spreadsheet program
b. word processor program
c. graphics program
d. all of the above

Answers:

1. c    2. b    3. e     4. a     5. c    6. c     7. d    8. c     9. a     10. d

Database Management System and Design MCQ Set 2

Database Management System and Design MCQ Set 2

Questions

Questions 1:

Which of the following fields in a student file can be used as a primary key?
a. class
b. Social Security Number
c. GPA
d. Major

Question 2:

Which of the following is not an advantage of the database approach
a. Elimination of data redundancy
b. Ability of associate deleted data
c. increased security
d. program/data independence
e. all of the above 

Question 3:

Which of the following contains a complete record of all activity that affected the contents of a database during a certain period of time?
a. report writer
b. query language
c. data manipulation language
d. transaction log
e. none of the above

Question 4:

In the DBMS approach, application programs perform the 
a. storage function
b. processing functions
c. access control
d. all of the above
e. none of the above

Question 5:

A set of programs that handle a firm's database responsibilities is called
a. database management system (DBMS)
b. database processing system (DBPS)
c. data management system (DMS)
d. all of above

Question 6:

Which is the make given to the database management system which is able to handle full text data, image data, audio and video?
a. full media
b. graphics media
c. multimedia
d. hypertext 

Question 7:

A record management system
a. can handle many files of information at a time
b. can be used to extract information stored in a computer file
c. always uses a list as its model
d. both a and b 

Question 8:

A command that lets you change one or more fields in a record is
a. insert
b. modify
c. lookup
d. none of above 

Question 9:

A transparent DBMS
a. can not hide sensitive information from users
b. keeps its logical structure hidden from users
c. keeps its physical structure hidden from users
d. both b and c 

Question 10:

A file produced by a spreadsheet 
a. is generally stored on disk in an ASCII text fromat
b. can be used as is by the DBMS
c. both a and b
d. none of the above

Answers:

1.b     2.e     3.d      4.b      5.d     6.c      7.b     8.b      9.c      10.a

Database Management System and Design MCQ Set 3

Database Management System and Design MCQ Set 3

Questions

Questions 1:

Which of the following is not true of the traditional approach to information processing
a. there is common sharing of data among the various applications
b. it is file oriented
c. programs are dependent on the file
d. it is inflexible
e. all of the above are true

Question 2:

Which of the following hardware component is the most important to the operation of database management system?
a. high resolution video display
b. printer
c. high speed, large capacity disk
d. plotter
e. mouse

Question 3:

Generalized database management system do not retrieve data to meet routine request
a. true
b. false

Question 4:

Batch processing is appropriate if
a. large computer system is available
b. only a small computer system is avilbale
c. only a few transactions are involved
d. all of the above
e. none of the above

Question 5:

Large collection of files are called
a. fields
b. records
c. database
d. sectors

Question 6:

Which of the following is not a relational database?
a. dBase IV
b. 4th Dimension
c. FoxPro
d. Reflex

Question 7:

In order to use a record management system 
a. you need to understand the low level details of how information is stored
b. you need to understand the model the record management system uses
c. bother a and b
d. none of the above

Question 8:

Sort/Report generators
a. are faster than index/report generators
b. require more disk space than indexed/report generators
c. do not need to sort before generating report
d. both a and b

Question 9:

If a piece of data is stored in two places in the database, then 
a. storage space is wasted
b. changing the data in one spot will cause data inconsistency
c. in can be more easily accessed
d. both and b

Question 10:

An audit trail
a. is used to make backup copies
b. is the recorded history of operations performed on a file
c. can be used to restore lost information
d. none of the aobve


Answers:

1.a     2.c     3. b     4.e      5.c     6.d      7.b      8.b      9.d      10.b