MCQOPTIONS
Saved Bookmarks
This section includes 1917 Mcqs, each offering curated multiple-choice questions to sharpen your UGC-NET knowledge and support exam preparation. Choose a topic below to get started.
| 551. |
Which of the following operators cannot be overloaded in C/C++? |
| A. | Bitwise right shift assignment |
| B. | Address of |
| C. | Indirection |
| D. | Structure reference |
| Answer» E. | |
| 552. |
The following ‘C’ statement :int * f[ ]( );declares : |
| A. | A function returning a pointer to an array of integers |
| B. | Array of functions returning pointers to integers |
| C. | A function returning an array of pointers to integers |
| D. | An illegal statement |
| Answer» C. A function returning an array of pointers to integers | |
| 553. |
Given i= 0, j = 1, k = – 1, x = 0.5, y = 0.0What is the output of given ‘C’ expression ?x * 3 & & 3 || j | k |
| A. | -1 |
| B. | 0 |
| C. | 1 |
| D. | 2 |
| Answer» D. 2 | |
| 554. |
Assume that the program ‘P’ is implementing parameter passing with ‘call by reference’. What will be printed by following print statements in P?Program P(){x = 10;y = 3;funb (y, x, x)print x;print y;}funb (x, y, z){y = y + 4;z = x + y + z;} |
| A. | 10, 7 |
| B. | 31, 3 |
| C. | 10, 3 |
| D. | 31, 7 |
| Answer» C. 10, 3 | |
| 555. |
A function template in C++ provides ............ level of generalization. |
| A. | 4 |
| B. | 3 |
| C. | 2 |
| D. | 1 |
| Answer» D. 1 | |
| 556. |
Consider the following program: |
| A. | x+x^2/2+x^3/3+x^4/4+... |
| B. | x+x^2/2!+x^3/3!+x^4/4!+... |
| C. | 1+x^2/2+x^3/3+x^4/4+... |
| D. | 1+x^2/2!+x^3/3!+x^4/4!+... |
| Answer» C. 1+x^2/2+x^3/3+x^4/4+... | |
| 557. |
In C++, which system-provided function is called when no handler is provided to deal with an exception? |
| A. | terminate() |
| B. | unexpected() |
| C. | abort() |
| D. | kill() |
| Answer» B. unexpected() | |
| 558. |
__________allows to create classes which are derived from other classes, so that they automatically include some of its "parent' s" members plus its own members. |
| A. | Overloading |
| B. | Inheritance |
| C. | Polymorphism |
| D. | Encapsulation |
| Answer» C. Polymorphism | |
| 559. |
C++ actually supports the following two complete dynamic systems: |
| A. | One defined by C++ and the other not defined by C |
| B. | One defined by C and one specific to C++ |
| C. | Both are specific to C++ |
| D. | Both of them are improvements of C |
| Answer» B. One defined by C and one specific to C++ | |
| 560. |
Match the following:List-I List-IIa. Automatic Storage Class i. Scope of the variable is global.b. Register Storage Class ii. Value of the variable persists between different function calls.c. Static Storage Class iii. Value stored in memory and local to the block in which the variable is defined.d. External Storage Class iv. Value stored in CPU registers.Codes: a b c d |
| A. | iii iv i ii |
| B. | iii iv ii i |
| C. | iv iii ii i |
| D. | iv iii i ii |
| Answer» C. iv iii ii i | |
| 561. |
Which of the following has, compilation error in C ? |
| A. | int n = 32 ; |
| B. | char ch = 65 ; |
| C. | float f= (float) 3.2 ; |
| D. | none of the above |
| Answer» E. | |
| 562. |
When an array is passed as parameter to a function, which of the following statements is correct? |
| A. | The function can change values in the original array. |
| B. | In C, parameters are passed by value, the function cannot change the original value in the array. |
| C. | It results in compilation error when the function tries to access the elements in the array. |
| D. | Results in a run time error when the function tries to access the elements in the array. |
| Answer» B. In C, parameters are passed by value, the function cannot change the original value in the array. | |
| 563. |
Important advantage of using new and delete operators in C++ is |
| A. | Allocation of memory |
| B. | Frees the memory previously allocated |
| C. | Initialization of memory easily |
| D. | Allocation of memory and frees the memory previously allocated |
| Answer» E. | |
| 564. |
Which of the following is not a member of class? |
| A. | Static function |
| B. | Friend function |
| C. | Const function |
| D. | Virtual function |
| Answer» C. Const function | |
| 565. |
Given that x = 7.5, j = -1.0, n = 1.0, m = 2.0The value of - - x + j = = x > n >= m is : |
| A. | 0 |
| B. | 1 |
| C. | 2 |
| D. | 3 |
| Answer» B. 1 | |
| 566. |
When the following code is executed , what will be the value of x and y ? int x =1, y= 0;y=x++; |
| A. | 2,1 |
| B. | 2,2 |
| C. | 1,1 |
| D. | 1,2 |
| Answer» B. 2,2 | |
| 567. |
When the inheritance is private, the private methods in base class are in the _______________ derived class (in C++). |
| A. | inaccessible |
| B. | accessible |
| C. | protected |
| D. | public |
| Answer» B. accessible | |
| 568. |
Which of the following, in C++, is inherited in a derived class from base class ? |
| A. | constructor |
| B. | destructor |
| C. | data members |
| D. | virtual methods |
| Answer» D. virtual methods | |
| 569. |
Which of the following differentiates between overloaded functions and overridden functions? |
| A. | Overloading is a dynamic or runtime binding and overridden is a static or compile time binding. |
| B. | Overloading is a static or compile time binding and overriding is dynamic or runtime binding. |
| C. | Redefining a function in a friend class is called overloading, while redefining a function in a derived class is called as overridden function. |
| D. | Redefining a function in a derived class is called function overloading, while redefining a function in a friend class is called function overriding. |
| Answer» C. Redefining a function in a friend class is called overloading, while redefining a function in a derived class is called as overridden function. | |
| 570. |
Which of the following statements is/are True?P: C programming language has a weak type system with static types.Q: Java programming language has a strong type system with static types. |
| A. | P only |
| B. | Q only |
| C. | Both P and Q |
| D. | Neither P nor Q |
| Answer» D. Neither P nor Q | |
| 571. |
If the following loop is implemented {int num=0;do{--num; printf(“%d”, num); num++;}while(num>=0)} |
| A. | the loop will run infinitely many times |
| B. | the program will not enter the loop |
| C. | there will be compilation error reported |
| D. | a run time error will be reported |
| Answer» D. a run time error will be reported | |
| 572. |
What will be the output of the following 'C' code?main ( ){ int x = 128; printf("\n%d”, 1 + x ++);} |
| A. | 128 |
| B. | 129 |
| C. | 130 |
| D. | 131 |
| Answer» C. 130 | |
| 573. |
Consider the following statements S1, S2 and S3 :S1 : In call-by-value, anything that is passed into a function call is unchanged in the caller's scope when the function returns.S2: In call-by-reference, a function receives implicit reference to a variable used as argument.S3: In call-by-reference, caller is unable to see the modified variable used as argument. |
| A. | S3 and S2 are true |
| B. | S3 and S1 are true |
| C. | S2 and S1 are true |
| D. | S1, S2, S3 are true |
| Answer» E. | |
| 574. |
Which of the following is incorrect in C++ ? |
| A. | When we write overloaded function we must code the function for each usage |
| B. | When we write function template we code the function only once |
| C. | It is difficult to debug macros |
| D. | Templates are more efficient than macros |
| Answer» E. | |
| 575. |
Which of the following is true? |
| A. | A “static” member of a class cannot be inherited by its derived class. |
| B. | A “static” member of a class can be initialized only within the class it is a member of. |
| C. | A “static” member of a class can be initialized before an object of that class is created. |
| D. | Since “static” member of a class is actually a global element, it does not require a class/object qualifier to access it independently of class/object. |
| Answer» D. Since “static” member of a class is actually a global element, it does not require a class/object qualifier to access it independently of class/object. | |
| 576. |
The control string in C++ consists of three important classifications of characters |
| A. | Escape sequence characters, Format specifiers and White-space characters |
| B. | Special characters, White-space characters and Non-white space characters |
| C. | Format specifiers, White-space characters and Non-white space characters |
| D. | Special characters. White-space characters and Format specifiers |
| Answer» D. Special characters. White-space characters and Format specifiers | |
| 577. |
Given i=0, j=1,k=-1 x=0.5, y=0.0What is the output of the following expression in C language.x*y |
| A. | -1 |
| B. | 0 |
| C. | 1 |
| D. | 2 |
| Answer» D. 2 | |
| 578. |
What does the following expression means?char *(*(*a[N]) ()) (); |
| A. | a pointer to a function returning array of n pointers to function returning character pointers |
| B. | a function return array of N pointers to functions returning pointers to characters |
| C. | an array of n pointers to function returning pointers to characters |
| D. | an array of n pointers to function returning pointers to functions returning pointers to characters |
| Answer» E. | |
| 579. |
After 3 calls of the c function bug() below, the values of i and j will be:int j = 1;bug(){ Static int i = 0; int j = 0;i++; j++;return (i) ; } |
| A. | i=0, j=0 |
| B. | i=3, j=3 |
| C. | i=3, j=0 |
| D. | i=3, j=1 |
| Answer» E. | |
| 580. |
In C++, a pointer that is automatically being passed to a member function during its invocation is: |
| A. | Base pointer |
| B. | Derived pointer |
| C. | Virtual pointer |
| D. | this pointer |
| Answer» E. | |
| 581. |
What will be the output of the following c-code?void main ( ){char *P = "ayqm" ;char c;c = ++*p ;printf ("%c", c);} |
| A. | a |
| B. | c |
| C. | b |
| D. | q |
| Answer» D. q | |
| 582. |
What is the output of the following program ?(Assume that the appropriate preprocessor directives are included and there is no syntax error)main ( ) { char S[ ] = "ABCDEFGH"; printf ("%C",* (& S[3])); printf ("%s", S + 4); printf ("%u", S); /* Base address of S is 1000 */ } |
| A. | ABCDEFGH1000 |
| B. | CDEFGH1000 |
| C. | DDEFGHH1000 |
| D. | DEFGH1000 |
| Answer» E. | |
| 583. |
The goal of operator overloading is |
| A. | to help the user of a class |
| B. | to help the developer of a class |
| C. | to help define friend function |
| D. | None of the above |
| Answer» B. to help the developer of a class | |
| 584. |
How many tokens will be generated by the scanner for the following statement?x = x * (a+b) - 5; |
| A. | 12 |
| B. | 11 |
| C. | 10 |
| D. | 7 |
| Answer» C. 10 | |
| 585. |
How many of the following declarations are correct?int z = 7.0;double void = 0.000;short array [2] = {0, 1, 2};char c = “\n”; |
| A. | None |
| B. | One is correct |
| C. | Two are correct |
| D. | All four are correct |
| Answer» D. All four are correct | |
| 586. |
The statementprint f (“ % d”, 10 ? 0 ? 5 : 1 : 12);will print |
| A. | 10 |
| B. | 0 |
| C. | 12 |
| D. | 1 |
| Answer» E. | |
| 587. |
Member of a class specified as …………… are accessible only to method of the class. |
| A. | private |
| B. | public |
| C. | protected |
| D. | derive |
| Answer» B. public | |
| 588. |
printf(“%c”, 100); |
| A. | prints 100 |
| B. | prints ASCII equivalent of 100 |
| C. | prints garbage |
| D. | none of the above |
| Answer» C. prints garbage | |
| 589. |
Match the following:a. calloc( ) i. Frees previously allocated spaceb. free( ) ii. Modifies previously allocated spacec. malloc( ) iii. Allocates space for arrayd. realloc( ) iv. Allocates requested size of spaceCodes: a b c d |
| A. | iii i iv ii |
| B. | iii ii i iv |
| C. | iii iv i ii |
| D. | iv ii iii i |
| Answer» B. iii ii i iv | |
| 590. |
Trace the error:void main( ){int *b, &a;*b = 20printf(“%d, %d”, a, *b)} |
| A. | No error |
| B. | Logical error |
| C. | Syntax error |
| D. | Semantic error |
| Answer» D. Semantic error | |
| 591. |
The ………….. memory allocation function modifies the previous allocated space. |
| A. | calloc( ) |
| B. | free( ) |
| C. | malloc( ) |
| D. | realloc( ) |
| Answer» E. | |
| 592. |
Which one of the following sentences is true? |
| A. | The body of a while loop is executed at least once. |
| B. | The body of a do … while loop is executed at least once. |
| C. | The body of a do … while loop is executed zero or more times. |
| D. | A for loop can never be used in place of a while loop. |
| Answer» C. The body of a do … while loop is executed zero or more times. | |
| 593. |
A copy constructor is invoked when: |
| A. | a function returns by value |
| B. | an argument is passed by value |
| C. | a function returns by reference |
| D. | none of the above |
| Answer» C. a function returns by reference | |
| 594. |
What is the value of ‘b’ after the execution of the following code statements:C=10;B=++c+++c; |
| A. | 20 |
| B. | 22 |
| C. | 23 |
| D. | None of the above |
| Answer» E. | |
| 595. |
Which of the following does not represent a valid storage class in ’c’? |
| A. | automatic |
| B. | static |
| C. | union |
| D. | extern |
| Answer» D. extern | |
| 596. |
The output of the program codemain(){int x=0;while (x |
| A. | x=1 |
| B. | compilation error |
| C. | x=20 |
| D. | none of the above |
| Answer» D. none of the above | |
| 597. |
A …………….. is a special method used to initialize the instance variable of a class. |
| A. | Member function |
| B. | Destructor |
| C. | Constructor |
| D. | Structure |
| Answer» D. Structure | |
| 598. |
The friend functions are used in situations where: |
| A. | We want to have access to unrelated classes |
| B. | Dynamic binding is required |
| C. | Exchange of data between classes to take place |
| D. | None of the above |
| Answer» D. None of the above | |
| 599. |
What would be the output of the following program, if run from the command line as “myprog 1 2 3”?main (int argc, char * argv[ ]){ int i ;i = argv[1] + argv[2] + argv[3] ;printf (“% d”, i) ;} |
| A. | 123 |
| B. | 6 |
| C. | Error |
| D. | “123” |
| Answer» D. “123” | |
| 600. |
Which one of the following describes correctly a static variable? |
| A. | It cannot be initialized |
| B. | It is initialized once at the commencement of execution and cannot be changed at run time |
| C. | It retains its value during the life of the program |
| D. | None of the above |
| Answer» D. None of the above | |