Tag: science & technology

Questions Related to science & technology

Multiple choice general knowledge science & technology
  1. ios

  2. fstream

  3. ostream

  4. All the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In C++, ios is the base class for all I/O stream classes, fstream handles file input/output operations, and ostream is the base class for output streams. Since all three (ios, fstream, and ostream) are legitimate stream classes in C++'s I/O hierarchy, option D is the correct choice. This question tests knowledge of the C++ stream class hierarchy.

Multiple choice general knowledge science & technology
  1. Extensibility

  2. Operator not limited to operate only with primitive Data Type

  3. Both A and B

  4. Operator's Scope is increased

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Operator overloading allows operators to work with user-defined types (extensibility) and means operators are not limited to primitive data types only. Both statements A and B are correct advantages, making 'Both A and B' the right answer. Option D about increased scope is vague - the scope isn't increased but rather extended to work with custom types.

Multiple choice general knowledge science & technology
  1. &exforsys[0]

  2. &exforsys[9]

  3. *exforsys[0]

  4. *exforsys[1]

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In C++, an array name evaluates to a pointer to its first element. Therefore, exforsys is equivalent to &exforsys[0], which is the address of the first element. This is a fundamental property of arrays in C and C++ - the array name decays to a pointer to the initial element when used in an expression.

Multiple choice general knowledge science & technology
  1. dalloc

  2. calloc

  3. malloc

  4. new

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In C++, the 'new' keyword is the standard operator for dynamic memory allocation. While malloc and calloc are C functions that can be used in C++, 'new' is the preferred C++ approach because it calls constructors and is type-safe. 'dalloc' is not a standard memory allocation function in C or C++.

Multiple choice general knowledge science & technology
  1. 0

  2. 1

  3. morethan 1

  4. depends on number of arguments

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A C++ function can only return exactly one value. However, this single return value can be a compound type like struct, array, or tuple containing multiple values, or you can use output parameters/pointers to return multiple values indirectly. The function itself has exactly one return statement that returns one value.

Multiple choice general knowledge science & technology
  1. static variables

  2. register variables

  3. global variables

  4. auto variables

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

External variables are defined outside all functions and have global scope, making them accessible throughout the program. They are commonly called global variables because any function can access them. Static variables have internal linkage, register variables suggest CPU register storage, and auto variables are local function variables - none of these describe external variables.

Multiple choice general knowledge science & technology
  1. saves program development time

  2. code reusability

  3. data hiding

  4. A and B

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Inheritance enables code reusability by allowing new classes to inherit properties and methods from existing classes, which saves program development time. Data hiding is primarily achieved through encapsulation (access specifiers), not inheritance. The advantage combines both A and B - you get reusable code that reduces development effort.

Multiple choice general knowledge science & technology
  1. Extraction Operator

  2. Insertion Operator

  3. Questionmark Colon operator

  4. Scope resolution operator

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The scope resolution operator (::) connects a member function definition to its class when defined outside. You write ReturnType ClassName::functionName(parameters) to show this function belongs to ClassName. The extraction (>>), insertion (<<), and ternary (? :) operators serve completely different purposes in C++.