Explore topic-wise MCQs in Artificial Intelligence.

This section includes 172 Mcqs, each offering curated multiple-choice questions to sharpen your Artificial Intelligence knowledge and support exam preparation. Choose a topic below to get started.

101.

Name the header file to be included for the use of built in function isalnum().

A. string.h
B. process.h
C. ctype.h
D. dos.h
Answer» D. dos.h
102.

To convert from a user defined class to a basic type, you would most likely use

A. A built-in conversion function
B. A one-argument constructor
C. A conversion function that’s a member of the class
D. An overloaded ‘=‘ operator
Answer» D. An overloaded ‘=‘ operator
103.

What will be the values of x, m and n after the execution of the following statements?int x, m, n;m = 10;n = 15;x = ++m + n++;

A. x=25, m=10, n=15
B. x=26, m=11, n=16
C. x=27, m=11, n=16
D. x=27, m=10, n=15
Answer» C. x=27, m=11, n=16
104.

A class defined within another class is:

A. Nested class
B. Inheritance
C. Containership
D. Encapsulation
Answer» B. Inheritance
105.

Which of the following expressions is illegal?

A. (10| 6)
B. (false && true)
C. bool (x) = (bool)10;
D. float y = 12.67;
Answer» D. float y = 12.67;
106.

The actual source code for implementing a template function is created when

A. The declaration of function appears
B. The function is invoked
C. The definition of the function appears
D. None of the above
Answer» C. The definition of the function appears
107.

What is the error in the following code? class t { virtual void print(); }

A. No error
B. Function print() should be declared as static
C. Function print() should be defined
D. Class t should contain data members
Answer» B. Function print() should be declared as static
108.

A white space is :

A. blank space
B. new line
C. tab
D. all of the above
Answer» E.
109.

In programming, reusable code is the use of similar code in

A. single function
B. two functions
C. multiple functions
D. can't use similar code
Answer» D. can't use similar code
110.

A base class contains elements common to a group of

A. parent classes
B. derived classes
C. sub classes
D. variables
Answer» C. sub classes
111.

One object oriented class can become parent of several

A. objects
B. sub classes
C. sub objects
D. variables
Answer» C. sub objects
112.

For human being, eye color is a

A. attribute
B. behavior
C. constant
D. loop
Answer» B. behavior
113.

C++ was originally called

A. C with objects
B. C with classes
C. C with functions
D. C with loops
Answer» C. C with functions
114.

Access to private data

A. Restricted to methods of the same class
B. Restricted to methods of other classes
C. Available to methods of the same class and other classes
D. Not an issue because the program will not compile
Answer» C. Available to methods of the same class and other classes
115.

The members of a class by default are

A. Public
B. Protected
C. Private
D. Mandatory to specify
Answer» D. Mandatory to specify
116.

Use of virtual functions implies

A. overloading
B. overriding
C. static binding
D. dynamic binding
Answer» E.
117.

Consider the following statements char *ptr; ptr = “hello”; cout << *ptr; What will be printed?

A. first letter
B. entire string
C. it is a syntax error
D. last letter
Answer» B. entire string
118.

Consider the following statements: int x = 22,y=15; x = (x>y) ? (x+y) : (x-y); What will be the value of x after executing these statements?

A. 22
B. 37
C. 7
D. Error. Cannot be executed
Answer» C. 7
119.

A library function exit() causes an exit from

A. the loop in which it occurs
B. the block in which it occurs
C. the function in which it occurs
D. the program in which it occurs
Answer» E.
120.

Objects are members of

A. classes
B. functions
C. variables
D. data
Answer» B. functions
121.

In Smalltalk language, object functions are named as

A. member functions
B. methods
C. local functions
D. linear functions
Answer» C. local functions
122.

Most individual program statements in C++ are similar to statements in

A. procedural language
B. machine language
C. assembly language
D. JAVA
Answer» B. machine language
123.

In a one class, we can define

A. one object
B. two objects
C. multiple objects
D. no object
Answer» D. no object
124.

A template class

A. is designed to be stored in different containers
B. works with different data types
C. generates objects which must be identical
D. generates classes with different numbers of member functions
Answer» C. generates objects which must be identical
125.

If a base class destructor is not virtual, then

A. It can not have a function body
B. It can not be called
C. It can not be called when accessed from pointer
D. Destructor in derived class can not be called when accessed through a pointer to the base class
Answer» E.
126.

If an array is declared asint a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ________.

A. 3, 2
B. 0, 2
C. 3, 0
D. 0, 4
Answer» D. 0, 4
127.

It is possible to declare as a friend

A. a member function
B. a global function
C. a class
D. all of the above
Answer» E.
128.

If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain a virtual member function abc(), then the statement p->abc(); will cause the version of abc() in the __________class to be executed.

A. Base Class
B. Derived class
C. Produces compile time error
D. produces runtime error
Answer» C. Produces compile time error
129.

Behaviors in the real world are equivalent to program's

A. data
B. function
C. module
D. loop
Answer» C. module
130.

In C++, dynamic memory allocation is accomplished with the operator ____

A. new
B. this
C. malloc()
D. delete
Answer» B. this
131.

Point on a plane is data type which is

A. by default
B. randomly defined
C. user defined
D. not a data type
Answer» D. not a data type
132.

Entire member function in C++ program resembles procedural function of

A. SmallTalk
B. C++
C. JAVA
D. PHP
Answer» C. JAVA
133.

_________ members of a base class are never accessible to a derived class.

A. Public
B. Private
C. Protected
D. All of the above
Answer» C. Protected
134.

Runtime polymorphism is achieved by

A. Friend function
B. Virtual function
C. Operator overloading
D. Function overloading
Answer» C. Operator overloading
135.

Which of the statements are true ?I. Function overloading is done at compile time.II. Protected members are accessible to the member of derived class.III. A derived class inherits constructors and destructors.IV. A friend function can be called like a normal function.V. Nested class is a derived class.

A. I, II, III
B. II, III, V
C. III, IV, V
D. I, II, IV
Answer» E.
136.

The address of a variable temp of type float is

A. *temp
B. &temp
C. float& temp
D. float temp&
Answer» C. float& temp
137.

The keyword friend does not appear in

A. the class allowing access to another class
B. the class desiring access to another class
C. the private section of a class
D. the public section of a class
Answer» D. the public section of a class
138.

A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is __________

A. call by name
B. call by value
C. call by reference
D. call by value result
Answer» C. call by reference
139.

A friend function to a class, C cannot access

A. private data members and member functions
B. public data members and member functions
C. protected data members and member functions
D. the data members of the derived class of C
Answer» E.
140.

If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access

A. protected and public data only in C and B
B. protected and public data only in C
C. private data in A and B
D. protected data in A and B
Answer» E.
141.

There is no close match exist between programming constructs and items being modeled in

A. procedural language
B. Object oriented language
C. C++
D. JAVA
Answer» B. Object oriented language
142.

Overloading is the kind of

A. polymorphism
B. dimorphism
C. trimorphisim
D. automorphism
Answer» B. dimorphism
143.

Something a real world object does in response to some stimulus is termed as

A. attribute
B. behavior
C. constant
D. loop
Answer» C. constant
144.

Bundling data and function together is termed as

A. encapsulation
B. declaration
C. initialization
D. deletion
Answer» B. declaration
145.

Data type integer is declared by syntax

A. int
B. integer
C. INt
D. INT
Answer» B. integer
146.

In C++, object's function is known as

A. member function
B. bit function
C. obj function
D. linear function
Answer» B. bit function
147.

C++ was originally developed by

A. Clocksin and Melish
B. Donald E.Knuth
C. Sir Richard Hadlee
D. Bjarne Stroustrup
Answer» E.
148.

Given a class named Book, which of the following is not a valid constructor?

A. Book ( ) { }
B. Book ( Book b) { }
C. Book ( Book &b) { }
D. Book (char* author, char* title) { }
Answer» C. Book ( Book &b) { }
149.

A static function

A. should be called when an object is destroyed
B. is closely connected with and individual object of a class
C. can be called using the class name and function name
D. is used when a dummy object must be created
Answer» D. is used when a dummy object must be created
150.

If we store the address of a derived class object into a variable whose type is a pointer to the base class, then the object, when accessed using this pointer.

A. continues to act like a derived class object
B. continues to act like a derived class object if virtual functions are called
C. Acts like a base class object
D. Acts like a base class, if virtual functions are called
Answer» C. Acts like a base class object