A. istream.
B. ostream.
C. cin.
D. cout.
put() is an output function so it is present in the output stream.
A. putchar( ).
B. getchar( ).
C. puts( ).
D. gets( ).
getchar() is an input function which reads the character pressed by the user on the keyboard.
A. get( ).
B. put( ) & puts( ).
C. getline( ) & write.
D. putchar().
put() and puts() are output functions used to display the arguements passed to them.
A. multicharacter function.
B. string function.
C. single character outputfunction.
D. function to display a string.
putchar() is just the opposite of getchar(). It displays a single character.
A. ch=getchar( ).
B. getchar(ch).
C. putchar(b).
D. puts(“eureka”);.
the prototype of getchar is int getchar(void) so it cannot receive any arguement.
A. white spaces.
B. newline.
C. white spaces and newline.
D. white spaces or newline.
getline() is a function used to accept a string. So it can accept white spaces as well as newline.
A. tab.
B. newline.
C. spacebar.
D. All whitespaces.
get() is a replacement for cin object. cin cannot accept whitespaces among the strings. Therefore in this case get() is preferred.
A. a string of 27 characters.
B. a string of 26 characters.
C. null string.
D. ‘/0’ as the first
cin.getline() function's protype is getline(str,MAX,DELIM) which extracts charcters into an array str of length MAX.
A. character.
B. multi character function.
C. single character function.
D. fuction to dispaly a string.
putchar() is an output function having the prototype putchar(ch) which is used to display a single character.
A. multicharacter function.
B. string function.
C. alphabetical characters function.
D. single character function.
get() function has the prototype get(ch) which extracts one character into ch.
A. gets( ) & puts( ).
B. putchar( ).
C. getchar( ).
D. gets(), puts(), getchar(), putchar().
All of these are unformatted console functions beacause we don't have control over the number of characters that would get extracted into or from the string.
A. < string.h>.
B. < math.h>.
C. < conio.h>.
D. < iostream.h>.
istream stands for input stream while ostream stands for output stream. Both of them combined together form the iostream which contains all input output functions.
A. ostream.
B. cin istream from keyboard.
C. cin in one line.
D. cout stream.
Function getline() gets invoked when a line of text is invoked in cin object.
A. isalpha().
B. islower().
C. isupper().
D. isupper&lower().
It returns false, if anything other than the alphabet is passed to this function.
A. isdigit().
B. is0to9().
C. isadigit().
D. isnotalpha().
It returns false, if anything other than the digit is passed to this function.
A. strcat(s1,s2).
B. strcat(s2,s1).
C. strconcate(s2,s1).
D. strcpy(s1,s2).
Here, array s1 must have enough reserved elements to hold both the strings.
A. strcpy(s1,s2).
B. strcat(s2,s1).
C. strcmp(s1,s2).
D. strcomp(s2,s1).
If s1 alphabetises before s2, strcmp() returns a negative value. If s1 and s2 are exacty the same, it returns zero. If s1 alphabetises after s2, strcmp() returns a positive value.
A. < stdio.h>.
B. < conio.h>.
C. < iostream.h>.
D. < iomanip.h>.
A. < stdio.h>.
B. < conio.h>.
C. < iostream.h>.
D. < iomanip.h>.
A. < conio.h>.
B. < stdio.h>.
C. < math.h>.
D. < string.h>.
It defines types and macros needed for standard I/O package.
A. < fstream.h>.
B. < stdio.h>.
C. < file.h>.
D. < conio.h>.
The header file fstream provides an interface to read and write data from files as input/output streams.
A. < istream.h>.
B. < ostream.h>.
C. < fstream.h>.
D. < stdlib.h>.
It declares several commonly used routines, like conversion routines, search/sort routines etc.
A. < strings.h>.
B. < string.h>.
C. < stream.h>.
D. < stdio.h>.
It declares several string manipulations and memory manipulation routines.
A. perform token replacement.
B. perform preprocessor operations.
C. include two header files at the same time.
D. include a library function.
# is used for preprocessor directives and ## is used to perform token replacement and merging, during the preprocessor scanning phase.
A. setw, setiosflags, setfill, setprecision.
B. cout, cin.
C. ‘n’.
D. setw, endl and scope resolution operator.
setw, setiosflags, setfill, setprecision, endl are manipulators. Manipulators are used to change formatting parameters on streams, and to insert or extract certain special characters.
A. within square brackets.
B. within angular bracket.
C. within curly braces.
D. no bracket used etc.
Every function in C++ has its code within curly braces. {}
A. < string.h>.
B. < stdio.h>.
C. < math.h>.
D. < ctype.h>.
This header file provides interfaces, for developing multi-threaded applications.
A. isupper().
B. toupper().
C. upper().
D. uppercase().
It returns true (non-zero), if it is an uppercase alphabet.
A. class.
B. library.
C. group of programs.
D. sub class.
Libraries are a helper code used in other independent programs.
A. < stdio.h>.
B. < string.h>.
C. < math.h>.
D. < iomanip.h>.
The header file stdio.h defines the standard I/O predefined streams.
A. library codes.
B. headings.
C. header files.
D. library files.
Header files contain standard functions defined in C++ standard library, that a program may use.
A. < stdio.h>.
B. < string.h>.
C. < math.h>.
D. < iomanip.h>.
The header file math.h declares prototypes for the math functions and math error handlers.
A. < iostream.h>.
B. < string.h>.
C. < stdio.h>.
D. < iomanip.h>.
The header file iostream.h declares the basic C++ stream I/O routines.
A. ostream.
B. istream.
C. input.
D. cin.
getline() is a function used when the user wants to read the text from the file one line at a time.
A. single character functions.
B. string character functions.
C. characters.
D. all types of arrays fuction.
gets() is used to input a string while puts() is used to display a string.
A. get string variable called name.
B. only the last character of the string.
C. ‘/0’.
D. will get only the first charcter of the string.
gets( name) is a function that receives a string. So when gets(name) is invoked it would display the string present in name.
A. input function and reads a line of text ending with a newline character.
B. output function.
C. function that reads digits only.
D. input function that reads a string.
The protype of getline is getline(str,MAX,DELIM) which extracts into array str, until mAX characters or the DELIM character. Extracts DELIM character.
A. stdlib.h.
B. iomanip.h.
C. string functions.
D. character functions.
iomanip.h declares the C++ streams I/O manipulators and contain macros for creating parametrised manipulators.
A. strcpy( ).
B. strcat( ).
C. tolower( ).
D. strcmp( ).
It allows one memory block to be appeneded to another.
A. function prototypes.
B. stdio package.
C. only data types.
D. only constants.
The C and C++ standard library traditionally declare their standard functions in header files.
A. stdlib.h
B. iostream.h
C. iomanip.h
D. stdio.h
This header file declares sveral commaonly used routines like conversion routines,search/sort routines.
A. getchar( ).
B. getline( ).
C. write( ).
D. getchar(),getline() and write().
all of the three functions can be used to do processing on strings.They are used to input a string from the keyboard.
A. unformatted string function.
B. < stdio.h>.
C. < iostream.h> .
D. console I/O function.
getchar() being a standard input function is present in the stdio.h header file.
A. cout.write(string1,size1).write(string2,size2);
B. cout.write(string 1,string 2);
C. cout.write(string1,size1),write(string2,size2);
D. cout.write(string1,size1)+write(string2,size2);
The write function contains two arguments. The first argument represents the string and the second argument represent number of character to be displayed. Two write functions can be combined as follows- cout.write(string1,size1).write(string2,size2);
A. 1
B. 0
C. 5
D. 9
The minimum value displayed by the following statement will be 5 (0+5=5).
A. standard library.
B. I/O file.
C. header files.
D. iostream.h.
The prototypes for wide ranging and diverse functions are given in header files. Header files are the component files of standard library that store various functions and their prototypes etc.
A. 34
B. 33
C. 32
D. 35
The random() function generates the random between 0 to range-1. Therefore the statement random(34) will return the minimum value as 0 and maximum value as 33.
A. string.h.
B. stdlib.h.
C. stdio.h.
D. ctype.h.
These predefined streams of stdio.h automatically open when program starts. Stdin & stdout are for standard input and output device. Stderr is for standard error output device and stdprn for standard printer.
A. clear()
B. cls();
C. conio.h
D. clrscr();
The function clrscr() is used to clear the output screen. It is defined under header file conio.h.
A. Integer functions
B. String functions
C. Decimal functions
D. Character functions
The header file ctype.h is used to character functions. It contains various built in functions to perform operations on characters.
A. 0
B. 1
C. 2
D. 9
The minimum value returned by the function random(10) will be 0. The random() generates the random numbers between 0 to range-1.
A. strcpy( );
B. strcat( );
C. tolower( );
D. strcmp( );
The function strcat(); is used to concatenate first string argument with the second string argument. The header file string.h is required to use this function.
A. 1
B. 0
C. *
D. c
The output of the code cout << isalpha( c ); will be 0. The function isalpha() returns nonzero if its argument is an alphabet, otherwise it returns zero.
A. string manipulations.
B. error handlers.
C. type and macros needed for standard I/O package.
D. conversion routines.
The header file stdio.h file defines types and macros needed for the standard I/O package. This file also defines the standard I/O predefined streams.
A. rand()
B. random(num)
C. srandom(num)
D. randomize()
The function random() is used to generate a random numbers according to the argument passed. The function random(num) will generate random number between 0 to num-1.
A. separate programs.
B. a file.
C. standard c++ library.
D. sub programmes.
Basic elements of C++ are stored in C++ standard library. It provides definitions of various build in functions, classes and objects.
A. rand.h
B. random.h
C. stdio.h
D. stdlib.h
To generate random numbers in C++, the header file stdlib.h is used. The header file stdlib.h contains rand(), srand(), random() and randomize() functions to generate header files.
A. isalnum()
B. isalphanum()
C. isalpha()
D. isnum()
The function isalnum() is a character function and it checks whether its arguments are alphanumeric or not.
A. Variables
B. Functions
C. Objects
D. Header files
Header files are component files of C++ standard library that stores various functions i.e., their prototypes, declarations for library functions, data types and constants used with them.
A. strlen()
B. strcpy();
C. strcat();
D. strcmp();
The method strcmp() compares two strings and returns less than zero value if the first string is less than the second string; returns zero value if both the strings are equal; and more than zero value if the first string is greater than the second string.
A. gotoxy( ), clrscr( )
B. getchar( ), getche( ), getch( )
C. Screen input / output
D. All of the above
Header file defines all the functions Mentioned in the question.
A. Functions
B. Header files
C. Compiler
D. Objects
The header files defined in C++ contains definition of various predefined classes, function and object etc. These predefined functions simplifies the user's work during the code definition.
A. tolower()
B. toupper()
C. isdigit()
D. islower()
The islower() is a character function which checks whether its argument is a lowercase letter or not.
A. multicharacter function.
B. single character function.
C. not a function.
D. user defined function.
getchar() is a standard library function that takes a single character as an input.
A. < conio.h>.
B. < iostream.h>.
C. < string.h>.
D. < process.h>.
cout and cin are used for displaying output and receiving input respectively and are include in the iostream.
A. data types
B. Statements
C. Functions that are not used
D. functions
The C++ Standard Library is a collection of classes and functions, that are written in the core language. The user need to specify the appropriate header files before using the function associated with it.
A. function prototypes.
B. stdio package.
C. only data types.
D. only constants.
Header contains definitions of various built in functions and objects. Therefore, to use any library function, the appropriate header file needs to be included in the program.
A. < iostream.h>.
B. < conio.h/>.
C. < stdio.h> .
D. < string.h>.
gets() and puts() are functions that perform processing on input and output data.
A. getline( ).
B. puts( ).
C. write( ).
D. getchar( ).
the function puts() is used to display a string of charcters on the screen.
A. stdlib.h
B. iomanip.h
C. math.h
D. iostream.h
iostream.h header file defines these functions.
A. stdio.h
B. math.h
C. string.h
D. iomanip.h
This header file defines types and macros needed for the standard I/o package.
A. variety of types.
B. same type.
C. hetregenous types.
D. strings only.
C++ library is a collection of functions, constants, classes, objects, and templates that extends the C++ language.
A. standard library.
B. I/O file.
C. header files.
D. iostream.h.
A header file contains forward declaration of classes, subroutines, variables, and other identifiers.
A. the character does not wait for enter key to be pressed to go to memory.
B. character goes to the function mentioned.
C. character does not go to the function mentioned.
D. the character goes in the memory when enter key is pressed.
The character goes to the memory at pressing enter and can be erased if mistyped.
A. < stdio.h>.
B. < conio.h>.
C. < iostream.h>.
D. < iomanip.h>.
iostream.h.
Yes,
Header files are included in C++ programs because these files allow the programmers to separate certain elements of program source code into reusable files.
No, the function fclose belongs to stdio.h.
The header file stdio.h defines the types and macros needed for the standard I/O package.
math.h
int isalnum (int ch) –
Header files are files containing class declarations, pre-processor directives.
char *strcat (char *str1, const char *str2)
string.h
1.
2. strncat(): appends characters from strings
The differences between the two functions are as follows:
• malloc() takes one argument, whereas calloc() takes two arguments.
• calloc() initializes all the bits in the allocated space to zero, whereas malloc() does not.
free() function is the function of the header file stdlib.h. The syntax of the free() function is as follows:
void free(void * ptr);
Parameters of free() function is a pointer, i.e., ptr.
A string is a sequence of characters. Common operations of a string are:
2. Comparison
A. it can be accessed by all files.
B. they can be accessed from any function.
C. they can be accessed only from the function that declares them.
D. all of the above.
Variables declared in function have function scope i.e they can be accessed only in the function that declares them.
A. size of the array may be passed to it.
B. size is not passed to it.
C. none of these ways.
D. function cannot be made general.
If any function is made to be general then the size of array is pass to it.
A. can appear on the left hand side of an expression.
B. can appear on the right hand side of an expression.
C. depends on the condition being met.
D. none of the above.
function should appear on the left-hand side of an assignment statements if it returns a reference to a variable.
for example: min(x,y) = -5;
it assigns -5 to the lesser of the two, x and y.
A. one step.
B. two steps.
C. three steps.
D. four steps.
For using a function, three steps are required:
(1) Function declaration.
(2) Function definition.
(3) Function call.
A. no value.
B. integer and non integer value.
C. references.
D. all of the above.
A function-
. Does not return any value if it is void type.
. May return integer or non integer value.
. May return references.
A. not related to each other.
B. closely related to each other.
C. are equivalent to each other.
D. none of the above.
Pointers and arrays are not exactly the same entity, but they're very close. In fact, an array is for all intents and purposes a constant pointer.
A. is a pointer to any element of the array.
B. Is a pointer to the first element.
C. not a pointer to the array.
D. not a pointer to the first element.
An array name is really a pointer to the first element of the array. For example, the following is legal.
int b[100]; // b is an array of 100 integers.
int* p; // p is a pointer to an integer.
p = b; // Assigns the address of first element of b to p.
p = &b[0]; // Exactly the same assignment as above.