{100+} Bpsc computer science mcq questions in c++ with answers यदि आप BPSC के द्वारा आयोजित किये जाने टीचर भर्ती परीक्षा की तैयारी कर रहे हैं तो आपके लिए बेहतरीन खुशखबरी है। BPSC ने टीचर भर्ती के 2nd फेज का नोटिफिकेशन जारी कर दिया गया है। आप सभी अपनी तैयारी शुरू कर दें। आप सभी तैयारी अच्छे से हो इसके लिए C ++ के 100 से अधिक क्वेश्चन आपके लिए उपलब्ध है। Computer Science MCQ for BPSC Computer Teacher,Computer Science Teacher Questions and Answers,BPSC Computer Science MCQ,Computer Science Objective & Practice Questions,Bpsc computer science mcq questions in c++ with answers pdf download,Bpsc computer science mcq questions in c++ with answers pdf,Bpsc computer science mcq questions in c++ with answers,Bpsc computer science mcq questions in c++ pdf download,Bpsc computer science mcq questions in c++ pdf.
Bpsc 2nd फेज नोटिफिकेशन के लिए निचे बटन पर क्लिक करें।
C++ Multiple-Choice Questions
- What is the primary purpose of a constructor in C++?
a. To initialize class variables
b. To allocate memory
c. To destroy objects
d. To define global variables
Answer: a - Which C++ data type is used to store a single character?
a. int
b. char
c. string
d. float
Answer: b - What is the output of the following code?
int x = 5;
cout << x++ + ++x;
a. 10
b. 11
c. 12
d. 13
Answer: d
- What does the ‘new’ operator do in C++?
a. Deletes a dynamic array
b. Allocates memory for a new object
c. Calls the constructor
d. Deallocates memory
Answer: b - In C++, what is a function prototype used for?
a. To define the function’s implementation
b. To declare the function’s existence
c. To define a class method
d. To initialize function parameters
Answer: b - What is the purpose of the ‘cin’ object in C++?
a. To output data to the console
b. To input data from the console
c. To define a class
d. To perform bitwise operations
Answer: b - How do you declare a constant in C++?
a. Using the keyword ‘constant’
b. Using the keyword ‘readonly’
c. Using the keyword ‘const’
d. Using the keyword ‘final’
Answer: c - What is the C++ operator used to access the member of a class or struct?
a. .
b. ::
c. ->
d. #
Answer: a - Which C++ container is implemented as a double-ended queue?
a. Stack
b. Queue
c. Vector
d. Deque
Answer: d - What is the purpose of the ‘break’ statement in a switch statement?
a. To exit the program
b. To skip the current iteration of a loop
c. To exit the switch statement
d. To restart the loop
Answer: c - What is the purpose of ‘const’ member functions in C++ classes?
a. They indicate that the function does not modify the calling object
b. They make the function more efficient
c. They allow the function to modify the calling object
d. They prevent the function from being called
Answer: a - What is the difference between ‘malloc’ and ‘new’ in C++?
a. ‘malloc’ is used for dynamic memory allocation, while ‘new’ is used for declaring variables
b. ‘malloc’ returns a pointer to an object, while ‘new’ returns a pointer to an array
c. ‘malloc’ calls the constructor, while ‘new’ doesn’t
d. ‘malloc’ is used for allocating memory on the stack, while ‘new’ is used for the heap
Answer: c - Which C++ operator is used to determine the memory address of a variable?
a. &
b. *
c. ::
d. ->
Answer: a - In C++, which loop is best suited for situations where the loop body must be executed at least once?
a. for
b. while
c. do-while
d. foreach
Answer: c - What is function overloading in C++?
a. Writing the same function multiple times with different implementations
b. Writing multiple functions with the same name but different parameters
c. Writing a function inside another function
d. Writing a function that calls itself
Answer: b - What is the purpose of the ‘endl’ manipulator in C++?
a. It ends the program
b. It inserts a new line and flushes the output buffer
c. It moves the cursor to the beginning of the line
d. It closes the input stream
Answer: b - Which keyword is used to inherit the properties of a base class into a derived class in C++?
a. extends
b. inherits
c. derives
d. : public
Answer: d - What is the maximum value that an ‘int’ data type can hold in C++ on most systems?
a. 32,767
b. 65,535
c. 2,147,483,647
d. 4,294,967,295
Answer: c - What does the ‘sizeof’ operator return in C++?
a. The size of an object in bytes
b. The address of an object
c. The value of an object
d. The type of an object
Answer: a - Which C++ header file should be included to work with files and streams?
a. iostream.h
b. fileio.h
c. fstream.h
d. streamfile.h
Answer: c - What is the purpose of the ‘static’ keyword in C++ when used with a variable?
a. It makes the variable invisible outside the current function
b. It allocates memory on the heap for the variable
c. It keeps the variable’s value across multiple function calls
d. It changes the variable’s data type
Answer: c - In C++, which keyword is used to define a derived class’s relationship with a base class as private inheritance?
a. private
b. protected
c. public
d. derived
Answer: a - What is the purpose of the ‘this’ pointer in C++?
a. It points to the next memory address
b. It points to the previous memory address
c. It points to the current object
d. It points to the base class
Answer: c - In C++, which type of inheritance allows a class to inherit from more than one base class?
a. Single Inheritance
b. Multiple Inheritance
c. Multilevel Inheritance
d. Hierarchical Inheritance
Answer: b - What is the role of the ‘virtual’ keyword when defining a member function in C++?
a. It defines a function that can be called from outside the class
b. It indicates that the function should be hidden from derived classes
c. It allows late binding (dynamic binding) of the function
d. It specifies that the function is a pure virtual function
Answer: c - Which operator is used to access the value at the memory location pointed to by a pointer in C++?
a. &
b. *
c. ->
d. ::
Answer: b - What is the main difference between a pointer and a reference in C++?
a. Pointers can be null, references cannot
b. Pointers have to be declared, references do not
c. Pointers cannot be used as function parameters, references can
d. Pointers are faster than references
Answer: a - What is a destructor in C++?
a. A function that constructs objects
b. A function that is called automatically when an object is destroyed
c. A function that deallocates memory
d. A function that returns a value
Answer: b - Which C++ standard library header file is used for input and output operations?
a. iostream.h
b. inputoutput.h
c. io.h
d. iostream
Answer: d - What is the purpose of the ‘friend’ keyword in C++?
a. It indicates a function that has access to the private members of a class
b. It defines a function that can be inherited by a derived class
c. It allows a class to access its own members
d. It specifies a class as a friend of another class
Answer: a - In C++, what is operator overloading?
a. Creating a new operator for custom operations
b. Using operators to control program execution
c. Defining multiple operators with the same functionality
d. Using the same operator for different data types
Answer: a - What is the purpose of the ‘continue’ statement in C++?
a. To exit the loop
b. To skip the current iteration and continue with the next
c. To restart the loop
d. To execute a specific block of code
Answer: b - Which C++ standard library container is typically implemented as a red-black tree?
a. List
b. Map
c. Vector
d. Queue
Answer: b - What is the output of the following code?
int x = 10, y = 5; x > y ? cout << "x is greater" : cout << "y is greater";
a. x is greater
b. y is greater
c. The code will not compile
d. No output is generated
Answer: a - What is the purpose of the ‘try-catch’ block in C++?
a. To handle exceptions and errors
b. To execute code repeatedly
c. To define a class
d. To manage memory allocation
Answer: a - Which C++ operator is used to perform bitwise AND?
a. &&
b. ||
c. &
d. |
Answer: c - In C++, what is a reference variable?
a. A variable that is used to store memory addresses
b. A variable that refers to another variable, acting as an alias
c. A variable that cannot be modified after initialization
d. A variable that is automatically deallocated
Answer: b - What is the purpose of the ‘new’ and ‘delete’ operators in C++?
a. To allocate and deallocate memory on the stack
b. To allocate and deallocate memory on the heap
c. To define new data types
d. To create and delete files
Answer: b - In C++, which type of inheritance allows a class to inherit from multiple classes at the same level?
a. Single Inheritance
b. Multiple Inheritance
c. Multilevel Inheritance
d. Hierarchical Inheritance
Answer: d - What does the ‘const’ keyword do when used in a C++ member function declaration?
a. It prevents the function from being called
b. It indicates that the function does not modify the calling object
c. It makes the function faster
d. It allows the function to access private members of the class
Answer: b
- What does the ‘sizeof’ operator return when used with a data type in C++?
a. The memory address of the data type
b. The data type’s value
c. The data type’s size in bytes
d. The data type’s name
Answer: c - What is a copy constructor in C++ used for?
a. Creating a shallow copy of an object
b. Creating a deep copy of an object
c. Initializing an object with another object of the same class
d. Converting one data type to another
Answer: c - Which keyword in C++ is used to define a class member that is shared among all objects of the class?
a. private
b. protected
c. public
d. static
Answer: d - In C++, what is the purpose of the ‘endl’ manipulator when used with ‘cout’?
a. It ends the program
b. It inserts a new line and flushes the output buffer
c. It closes the output stream
d. It adds a space before the next character
Answer: b - What is the purpose of the ‘typeid’ operator in C++?
a. To identify the type of a variable or expression
b. To declare the type of a variable
c. To access the data type of a variable
d. To define custom data types
Answer: a - In C++, what is a virtual destructor used for?
a. To prevent memory leaks
b. To allow dynamic binding
c. To access private members of a class
d. To delete an object
Answer: a - Which C++ operator is used to perform a logical OR operation?
a. &&
b. ||
c. |
d. !
Answer: b - What is a pure virtual function in C++?
a. A function that is implemented in a derived class
b. A function with no implementation in the base class
c. A function with no parameters
d. A function that cannot be overridden
Answer: b - In C++, what is the result of adding an integer and a floating-point number?
a. An integer
b. A floating-point number
c. A string
d. An error
Answer: b - What is the C++ scope resolution operator used for?
a. To access the base class members
b. To specify the class to which a member belongs
c. To create a new scope
d. To define a global variable
Answer: b - What is a lambda function in C++?
a. A function that cannot take any arguments
b. An anonymous function defined inline
c. A function that has no return statement
d. A function that returns a reference to a variable
Answer: b - What is the purpose of the ‘volatile’ keyword in C++?
a. To define a variable that cannot be changed
b. To indicate that a variable can be changed by external factors
c. To declare a variable as a constant
d. To specify that a variable is read-only
Answer: b - What does the ‘auto’ keyword do in C++11 and later?
a. It defines automatic variables
b. It automatically determines the data type of a variable
c. It declares a variable as an array
d. It creates a reference to an object
Answer: b - In C++, what is function template specialization used for?
a. Defining a new function template
b. Providing a specific implementation for a given data type
c. Defining multiple functions with the same name
d. Creating an instance of a class template
Answer: b - What is the C++ standard library container that stores elements in a sorted order?
a. List
b. Set
c. Vector
d. Queue
Answer: b - What is the role of the ‘mutable’ keyword in a C++ class member?
a. It indicates that the member is read-only
b. It allows the member to be modified in a ‘const’ member function
c. It prevents the member from being accessed
d. It defines a local variable
Answer: b - What does the ‘std::nothrow’ argument in the ‘new’ operator do in C++?
a. It throws an exception if memory allocation fails
b. It allocates memory on the stack
c. It returns a null pointer if memory allocation fails
d. It defines a custom allocation function
Answer: c - In C++, what is an inline function?
a. A function that is declared in the main program
b. A function that is automatically called
c. A function that is defined outside of the class
d. A function that is expanded by the compiler at the call site
Answer: d - What is the primary purpose of the ‘throw’ statement in C++?
a. To catch exceptions
b. To define a class
c. To signal an exception
d. To end a program
Answer: c - What is the output of the following code?
cpp int x = 5; int &y = x; y++; cout << x;
a. 4
b. 5
c. 6
d. Error
Answer: c
- What does the ‘delete’ operator do in C++?
a. It releases memory allocated using the ‘new’ operator
b. It creates a new object
c. It deletes a file
d. It deallocates memory on the stack
Answer: a - What is the purpose of the ‘const_cast’ operator in C++?
a. It is used to cast a constant pointer to a non-constant pointer
b. It is used to cast a non-constant pointer to a constant pointer
c. It is used to cast an integer to a floating-point number
d. It is used to perform bitwise operations
Answer: a - In C++, what is a template class used for?
a. To define a class that cannot be instantiated
b. To define a class with a fixed data type
c. To define a class that can work with different data types
d. To define a class that is derived from another class
Answer: c - What is the output of the following code?
int x = 5; int *y = &x; *y = 10; cout << x;
a. 5
b. 10
c. 15
d. Error
Answer: b - What is the role of the ‘using’ directive in C++?
a. It specifies the data type of a variable
b. It defines a new data type
c. It allows access to all members of a namespace
d. It declares a function
Answer: c - In C++, what is the purpose of the ‘inline’ keyword when used with a function?
a. It specifies that the function should be inlined
b. It declares the function as a friend of another class
c. It indicates that the function is virtual
d. It specifies that the function should be hidden from derived classes
Answer: a - What does the ‘namespace’ keyword do in C++?
a. It defines a new data type
b. It declares a new function
c. It defines a scope for names
d. It creates an object
Answer: c - In C++, what is the purpose of the ‘typeid’ operator when used with dynamic_cast?
a. To check the type of a variable during compilation
b. To check the type of a variable during runtime
c. To create a new type of object
d. To convert one data type to another
Answer: b - What is the output of the following code?
for (int i = 0; i < 5; i++) { if (i == 3) continue; cout << i; }
a. 0123
b. 0124
c. 01234
d. 012345
Answer: b - In C++, what is a macro?
a. A block of code within a function
b. A predefined class
c. A preprocessor directive that defines a text replacement
d. A reserved keyword
Answer: c - What is the purpose of the ‘endl’ manipulator when used with ‘cin’?
a. It ends the program
b. It inserts a new line and flushes the input buffer
c. It defines an integer variable
d. It skips the current input
Answer: b - What is the difference between ‘new’ and ‘malloc’ in C++?
a. ‘new’ is used for dynamic memory allocation, ‘malloc’ is used for declaring variables
b. ‘new’ returns a pointer to an object, ‘malloc’ returns a pointer to an array
c. ‘new’ calls the constructor, ‘malloc’ does not
d. ‘new’ is used for allocating memory on the heap, ‘malloc’ is used for the stack
Answer: c - What is the purpose of the ‘cin.ignore()’ function in C++?
a. To ignore all input from the user
b. To skip the next character in the input stream
c. To clear the input buffer
d. To exit the program
Answer: b - In C++, what does the ‘iostream’ header provide?
a. Input and output stream classes
b. Mathematical functions
c. String manipulation functions
d. File input and output functions
Answer: a - What does the ‘goto’ statement do in C++?
a. It defines a new function
b. It allows you to jump to a labeled point in the code
c. It creates a loop
d. It exits the program
Answer: b - What is the purpose of the ‘static_cast’ operator in C++?
a. To cast a derived class to a base class
b. To cast a constant pointer to a non-constant pointer
c. To cast one data type to another
d. To allocate memory on the stack
Answer: c - What is the result of the following code?
int x = 5; int y = x++; cout << y;
a. 5
b. 6
c. 10
d. Error
Answer: a - In C++, what is the default access specifier for class members if not specified?
a. private
b. protected
c. public
d. None; it is an error
Answer: a - What is the primary purpose of the ‘using namespace’ directive in C++?
a. To declare a new class
b. To specify a new data type
c. To access all names in a namespace without qualification
d. To hide class members from derived classes
Answer: c - What is the purpose of the ‘std’ namespace in C++?
a. It defines the standard input and output streams
b. It defines user-defined functions
c. It specifies a new data type
d. It is used to declare global variables
Answer: a
- What is the primary use of the ‘memcpy’ function in C++?
a. To allocate memory
b. To compare two strings
c. To copy a block of memory
d. To find the length of a string
Answer: c - What is the role of the ‘throw’ keyword in C++ exceptions?
a. To catch exceptions
b. To handle exceptions
c. To signal an exception
d. To exit the program
Answer: c - What is a reference variable in C++ used for?
a. To define a variable that cannot be modified
b. To refer to another variable, acting as an alias
c. To create a new variable
d. To declare a variable as a constant
Answer: b - In C++, what is a constructor initializer list used for?
a. To define the class constructor
b. To initialize class member variables
c. To define the class destructor
d. To create a class template
Answer: b - What does the ‘vector’ container in the C++ Standard Library provide?
a. A collection of key-value pairs
b. A dynamically resizable array
c. A queue with constant time insertion and deletion
d. A sorted collection of elements
Answer: b - What is the purpose of the ‘default’ keyword in C++11 and later?
a. To indicate that a function should not be called
b. To specify a default value for a function parameter
c. To create a default constructor or assignment operator
d. To declare a function as a template
Answer: c - What is the primary purpose of the ‘volatile’ keyword in C++?
a. To indicate that a variable cannot be changed
b. To optimize the program
c. To specify that a variable is read-only
d. To indicate that a variable can be changed by external factors
Answer: d - In C++, what is the difference between ‘break’ and ‘continue’ statements in a loop?
a. ‘break’ exits the loop, ‘continue’ skips the current iteration
b. ‘break’ continues to the next iteration, ‘continue’ exits the loop
c. ‘break’ ends the program, ‘continue’ restarts the loop
d. ‘break’ jumps to a labeled point in the code, ‘continue’ jumps to the next labeled point
Answer: a - What is a binary file in C++?
a. A file that contains only binary data
b. A file that can only be read by a binary reader
c. A file that can be read and written using both text and binary editors
d. A file that contains only text data
Answer: a - What is the purpose of the ‘extern’ keyword in C++?
a. To indicate that a variable or function is defined in another source file
b. To declare a variable as constant
c. To define a global variable
d. To hide a function from other classes
Answer: a - What is the purpose of the ‘enum’ keyword in C++?
a. To define a new data type
b. To create a new class
c. To define a variable
d. To declare a friend class
Answer: a - What is the primary purpose of the ‘union’ keyword in C++?
a. To define a class
b. To declare a variable
c. To group variables together, sharing the same memory space
d. To declare a member function
Answer: c - What is the purpose of the ‘make_pair’ function in C++ STL?
a. To create a new class object
b. To create a pair of values
c. To initialize a vector
d. To define a function
Answer: b - In C++, what is a shallow copy?
a. A copy that creates a new instance of the object
b. A copy that points to the same memory location as the original object
c. A copy that is created using the ‘new’ operator
d. A copy that is slower than a deep copy
Answer: b - What is the purpose of the ‘rand()’ function in C++?
a. To generate a random floating-point number between 0 and 1
b. To generate a random integer within a specified range
c. To initialize a random variable
d. To create a random character
Answer: b - What is operator precedence in C++?
a. The order in which operators are evaluated in an expression
b. The order in which functions are called
c. The order in which variables are declared
d. The order in which namespaces are accessed
Answer: a - What is the primary purpose of the ‘do-while’ loop in C++?
a. To create an infinite loop
b. To execute code at least once and then repeatedly based on a condition
c. To execute code a specified number of times
d. To iterate over elements in a collection
Answer: b - What is a C++ function template?
a. A template for creating objects
b. A template for creating functions
c. A template for defining classes
d. A generic function definition that can work with different data types
Answer: d - What is the role of the ‘reinterpret_cast’ operator in C++?
a. To cast a derived class to a base class
b. To perform a low-level reinterpretation of the bits in memory
c. To cast one data type to another
d. To perform type-safe casting
Answer: b - What is a polymorphic class in C++?
a. A class with multiple constructors
b. A class with multiple member variables
c. A class that allows for dynamic binding and overriding of functions
d. A class that cannot be inherited from
Answer: c
साराँश
दोस्तों उम्मीद है आप जानकारी जरूर पसंद आयी होगी। bpsc कंप्यूटर साइंस से जुड़े सभी जानकारी के लिए आप हमारे सोशल प्लेटफॉर्म से अवश्य जुड़ें।
whatsapp group | Click here |
Telegram | Click here |
facebook page | Click here |
Click here | |
Home page | click here |
डाउनलोड BPSC 2nd फेज नोटिफिकेशन | Click Here |
- {2024}आप भी बन सकते हैं prompt engineer kaise bane और लाखों रुपयों की कमाई कर सकते हैं।
- 10th के बाद डिजिटल मार्केटिंग करियर कैसे बनायें। digital marketing kya hai, होगी लाखों की कमाई 2023 में।
- [2024] 12th ke bad fashion designer kaise bane,12वीं के बाद फैशन डिजाइनिंग का कोर्स कर बना सकते हैं करियर, जानें कहां मिलेगी नौकरी
- बेल्ट्रॉन डाटा इंट्री ऑपरेटर की तैयारी घर बैठे करें।100+ MS word question for beltron DEO 2024.
- (70+) bpsc computer teacher DBMS mcq practice set 2023,कंप्यूटर टीचर की तैयारी होगी बंफर।