C/C /C Multiple Choice Questions Set-1 Sample Test,Sample questions

Question:
 A continue statement causes execution to skip to

1.the return 0; statement

2.the first statement after the loop

3.the statement following the continue statement

4.the next iteration of the loop


Question:
 Each pass through a loop is called a/an

1.enumeration

2. iteration

3.culmination

4.pass through


Question:
 If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?

1.X&

2.X*

3. const X* const

4.X* const


Question:
 In mulit-list organization

1.Records that have equivalent value for a given secondary index item are linked together to form a list.

2.Records are loaded in ordered sequence defined by collating sequence by content of the key

3.Records are directly accessed by record key field

4.None of the above


Question:
 Originally ‘C’ was developed as

1.System programming language

2.General purpose language

3.Data processing language

4.none of the above


Question:
 The default access level assigned to members of a class is _________

1.Private

2.Public

3.Protected

4.Needs to be assigned


Question:
 What does STL stand for?#

1.Simple Template Library

2.Standard Template Library

3.Static Type Library

4.Single Type-based Library


Question:
 What’s wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6)

1.the question mark should be an equal sign

2.the first semicolon should be a colon

3.there are too many variables in the statement

4. the conditional operator is only used with apstrings


Question:
 What’s wrong? for (int k = 2, k <=12, k++)

1. the increment should always be ++k

2.the variable must always be the letter i when using a for loop

3.there should be a semicolon at the end of the statement

4.the commas should be semicolons


Question:
 Which of the following correctly describes C++ language?

1.Statically typed language

2.Dynamically typed language

3.Both Statically and dynamically typed language

4.Type-less language


Question:
 Which of the following is/are advantages of cellular partitioned structure

1.Simultaneous read operations can be overlapped

2.Search time is reduced

3.Both a & b

4. None of the above


Question:
*ptr++ is equivalenet to

1.ptr++

2.*ptr

3.++*ptr

4. None of the above


Question:
An inverted file

1. Locates information about data in small files that are maintained apart from actual data record

2.A file which stores opposite records

3.A file which stores information about records of a system

4.none of the above


Question:
class derived: public base1, public base2 { } is an example of

1.Polymorphic inheritance

2.Multilevel inheritance

3.Hierarchical inheritance

4.Multiple inheritance


Question:
direct access file is:

1.A file in which recoreds are arranged in a way they are inserted in a file

2.A file in which records are arranged in a particular order

3.Files which are stored on a direct access storage medium

4.none of the above


Question:
Expression C=i++ causes

1.Value of i assigned to C and then i incremented by 1

2.i to be incremented by 1 and then value of i assigned to C

3.Value of i assigned to C

4. i to be incremented by 1


Question:
How do we declare an abstract class?

1.By providing at least one pure virtual method (function signature followed by ==0;) in a class

2.By declaring at least one method abstract using the keyword ‘abstract’ in a class

3.By declaring the class abstract with the keyword ‘abstract’

4.It is not possible to create abstract classes in C++


Question:
How do we declare an ‘interface’ class?

1. By making all the methods pure virtual in a class

2.By making all the methods abstract using the keyword ‘abstract’ in a class

3.By declaring the class as interface with the keyword ‘interface’

4.It is not possible to create interface class in C++


Question:
How many copies of a class static member are shared between objects of the class?

1.A copy of the static member is shared by all objects of a class

2.A copy is created only when at least one object is created from that class

3.A copy of the static member is created for each instntiation of the class

4.No memory is allocated for static members of a class


Question:
If class A is friend of class B and if class B is friend of class C, which of the following is true?

1.Class C is friend of class A

2.Class A is friend of class C

3.Class A and Class C do not have any friend relationship

4.none of the above


Question:
Latency time is

1.Time taken by read/write head mechanism to position itself over appropriate cylinder

2. Time taken to transfer a dta from memory

3. Time taken by appropriate sector to come under read/write head

4.None of above


Question:
Prime area’ in context of file system is defined as

1.It is memory area created by operating system

2.It is an area into which data records are written

3. It is the main area of a web page

4.None of the above


Question:
Seek time is

1.time taken to retrieve a dta

2.Time taken by read/write head mechanism to position itself over appropriate cylinder

3.Time taken by appropriate sector to come under read/write

4.None of the above


Question:
The conditional compilation

1. It is taken care of by the compiler

2.It is setting the compiler option conditionally

3.It is compiling a program based on a condition

4. None of the above


Question:
The two types of file structure existing in VSAM file are

1.Key sequenced structure, entry sequenced structure

2.Key sequence structure, exit sequenced structure

3.Entry sequence structure, exit sequenced structure

4.none of the above


Question:
What happens when a pointer is deleted twice?

1.It can abort the program

2.It can cause a failure

3.It can cause an error

4.It can cause a trap


Question:
What is the difference between overloaded functions and overridden functions?

1.Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding

2.Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called an overloaded function.

3.Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding

4.Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden function.


Question:
What’s wrong? while( (i < 10) && (i > 24))

1.the logical operator && cannot be used in a test condition

2.the while loop is an exit-condition loop

3. the test condition is always false

4.the test condition is always true


Question:
When is std::bad_alloc exception thrown?

1.When new operator cannot allocate memory

2.When alloc function fails

3.When type requested for new operation is considered bad, thisexception is thrown

4.When delete operator cannot delete the allocated (corrupted) object


Question:
Which classes allow primitive types to be accessed as objects?

1.Storage

2.Virtual

3.Friend

4.Wrapper


Question:
Which looping process checks the test condition at the end of the loop?

1.for

2.while

3.do-while

4.no looping process checks the test condition at the end


Question:
Which of the following correctly describes the meaning of ‘namespace’ feature in C++?

1.Namespaces refer to the memory space allocated for names used in a program

2.Namespaces refer to space between teh names in a program

3.Namespaces refer to space between the names in a program

4.namespaces provide facilities for organizing the names in a program to avoid name clashes


Question:
Which of the following correctly describes the meaning of‘namespace’ feature in C++?

1.Namespaces refer to the memory space allocated for names used in a program

2.Namespaces refer to space between the names in a program

3.Namespaces refer to packing structure of classes in a program.

4.Namespaces provide facilities for organizing the names in aprogram to avoid name clashes.


Question:
Which of the following is a valid destructor of the class name “Country”

1. int ~Country()

2.void Country()

3. int ~Country(Country obj)

4.. void ~Country()


Question:
Which of the following is not a component of file system

1.Access method

2.Auxiliary storage management

3.Free integrity mechanism

4.None of the above


Question:
Which of the following is not a file operation:

1.Repositioning

2.Truncating

3.Appending

4.none of the above


Question:
Which of the following is not a standard exception built in C++.

1.std::bad_creat

2.std::bad_alloc

3.std::bad_cast

4.std::bad_typeid


Question:
Which of the following is not an advantage of secondary memory

1. It is cost-effective

2. It has large storage capacity

3.It has highest speed

4.It is easily portable


Question:
Which of the following is not recommended in a header file?
 

1. Type definitions (typedefs)

2.Class definitions

3.Function definitions

4.Template definitions


Question:
Which of the following is not true about preprocessor directives

1. They begin with a hash symbol

2.They are processed by a preprocessor

3.They form an integral part of the code

4.They have to end with a semi colon


Question:
Which of the following is the most preferred way of throwing and handling exceptions?

1.Throw by value and catch by reference.

2.Throw by reference and catch by reference.

3.Throw by value and catch by value

4.Throw the pointer value and provide catch for the pointer type.


Question:
Which of the following is true about const member functions?

1.const members can be invoked on both const as well as nonconst objects

2.const members can be invoked only on const objects and not on nonconst objects

3.nonconst members can be invoked on const objects as well as nonconst objects

4.none of the above


Question:
Which of the following keyword supports dynamic method resolution?

1.abstract

2.Virtual

3.Dynamic

4.Typeid


Question:
Which of the following language feature is not an access specifier in C++?

1.public

2.private

3.protected

4.internal


Question:
Which of the following language is not supported by C++?

1.Exception Handling

2.Reflection

3.Operator Overloading

4.Namespaces


Question:
Which of the following languages is a subset of C++ language?

1. C language

2.Java Language

3.C# language

4.language


Question:
Which of the following relationship is known as inheritancerelationship?

1.has-a’ relationship

2.is-a’ relationship

3. association relationship

4.none of the above


Question:
Which of the STL containers store the elements contiguously (in adjacent memory locations)?

1.std::vector

2.std::list

3.std::map

4.std::set


Question:
Which one of the following is not a fundamental data type in C++

1.float

2.string

3.int

4.wchar_t


Question:
Which one of the following is not a valid reserved keyword in C++

1.Explicit

2.Public

3.Implicit

4.Private


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!