0
Alien head

Computer Basics (C++)

Description: A Multiple Choice Test in Object Oriented based Programming Language C++
Number of Questions: 25
Created by:
Tags: C++ BBA / BBS / BCA Information Technology MCA Entrance Class Objects Data Hiding Function Overloading Function Overriding Operator Overloading Programming Fundamentals of Computer Programming Computers
Attempted 0/25 Correct 0 Score 0

In C++, a function contained within a class is called ______.

  1. a member function

  2. a class

  3. an operator

  4. a data item


Correct Option: A

The break statement causes an exit ______.

  1. only from the innermost loop

  2. only from the innermost switch

  3. from all loops and switches

  4. from the innermost loop or switch


Correct Option: D

The && and || operators ____.

  1. compare two numeric values

  2. combine two numeric values

  3. compare two Boolean values

  4. combine two Boolean values


Correct Option: D

An array element is accessed using _______.

  1. the first-in first-out approach

  2. the dot operator

  3. a member name

  4. an index number


Correct Option: D

The function toascii() is declared in the header file _________.

  1. stdio.h

  2. math.h

  3. ctype.h

  4. string.h


Correct Option: B

Which of the following functions is used to input data from keyboard?

  1. cout

  2. cin

  3. cerr

  4. get


Correct Option: B

A stack is a linear data structure in which data is stored and retrieved in a _______.

  1. <>

  2. ##

  3. !=

  4. :=


Correct Option: C

A stack is a linear data structure in which data is stored and retrieved in a _____.

  1. Last Out First In (LOFI)

  2. Last In First Out (LIFO)

  3. First In First Out (FIFO)

  4. Last In Last Out (LILO)


Correct Option: B

Which of the following statements is the terminator in C++?

  1. ;

  2. ,

  3. :

  4. /


Correct Option: C

The keyword 'void' is used to _____.

  1. declare a member function that is defined in a subclass

  2. designate the absence of a type

  3. declare objects that can be modified outside of program control

  4. declare a synonym for an existing type


Correct Option: D

In C++, 'while' is a/an __________ control structure.

  1. sequential

  2. count

  3. repetitive

  4. incremental


Correct Option: B

When a multi-dimensional array is accessed, each array index is ________.

  1. separated by commas

  2. surrounded by brackets and separated by commas

  3. separated by commas and surrounded by brackets

  4. surrounded by brackets


Correct Option: A

Operator Overloading is _____.

  1. Making C+ operators work with objects

  2. Giving C++ operators more than they can handle

  3. Giving new meanings to existing C++ operators

  4. Making new C++ operators


Correct Option: C

On which of the following languages is C++ based?

  1. FORTRAN

  2. PASCAL

  3. C

  4. JAVA


Correct Option: A

Which of the following characters is known as a newline character?

  1. r

  2. d

  3. l

  4. c


Correct Option: C

What will be the output of the under given program?
#include<iosteam.h>
void main()
{
int k;
cout<<”k=”<<k;
}

  1. An error

  2. Unpredictable

  3. 567

  4. 0


Correct Option: B

Who developed C++?

  1. Dennis Ritchie

  2. Bjarne Stroustrup

  3. Blaise Pascal

  4. John Von Neuman


Correct Option: B

Which of the following operators is used for modulus or remainder?

  1. /

  2. //

  3. %

  4. %%


Correct Option: C

A pointer is _____.

  1. the address of a variable

  2. an indication of the variable to be accessed next

  3. a variable for storing addresses

  4. the data type of an address variable


Correct Option: C

What error would the following function give on compilation?
f(int a, int b)
{
int a;
a=20;
return a;
}

  1. Missing parentheses in return statement.

  2. The function should be defined as int f(int a, int b).

  3. Redeclaration of 'a'.

  4. None of the above


Correct Option: C

The 'goto statement' causes control to go to _____.

  1. an operator

  2. a label

  3. a variable

  4. a function


Correct Option: B

What will be the output of the given program?
#include<iostream.h>
void main ( )
{
int a=5;
cout<< ++a;
}

  1. 6

  2. 5

  3. 4

  4. 0


Correct Option: A

The library function exit ( ) causes an exit from _____.

  1. the loop in which it occurs

  2. the block in which it occurs

  3. the function in which it occurs

  4. the program in which it occurs


Correct Option: D

What will be the output of the given program?
#include<iostream.h>
void main ( )
{
int a=1;
for(;;)
{
cout<< a++;
if(a>10)
break;
}
}

  1. The condition in the for loop is must.

  2. The two semicolons should be dropped.

  3. The for loop should be replaced by a while loop.

  4. No error


Correct Option: D

What will be the output of the given program?
#include<iostream.h>
void main ( )
{
cout<< 5+ “Hello world”;
}

  1. Error

  2. Hello

  3. World

  4. None of the above


Correct Option: C
+ View questions