Menu
Popular Courses
Search

MCQs


Total Questions : 9
Question 1. The constants are also called as
  1.    const
  2.    preprocessor
  3.    literals
  4.    none of the mentioned
 Discuss Question
Answer: Option C. -> literals


literals


Question 2. What are the parts of the literal constants?
  1.    integer numerals
  2.    floating-point numerals
  3.    strings and boolean values
  4.    all of the mentioned
 Discuss Question
Answer: Option D. -> all of the mentioned


Because these are the types used to declare variables and so these can be declared as constants.


Question 3.

What is the output of this program?

#include < iostream >

using namespace std;

#define PI 3.14159

int main ()

{

float r = 2;

float circle;

circle = 2 * PI * r;

cout

  1.    12.566
  2.    13.566
  3.    10
  4.    compile time error
 Discuss Question
Answer: Option A. -> 12.566


In this program, we are finding the area of the circle by using concern formula.


Question 4.

What is the output of this program?

#include

using namespace std;

int main()

{

int  const  p = 5;

cout

  1.    5
  2.    6
  3.    Error
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> Error


We cannot modify a constant integer value.


Question 5. How the constants are declared?
  1.    const keyword
  2.    #define preprocessor
  3.    both a and b
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> both a and b


The const will declare with a specific type values and #define is used to declare user definied constants.


Question 6. Which of the following statement is true about preprocessor directives?
  1.    hese are lines read and processed by the preprocessor
  2.    They do not produce any code by themselves
  3.    These must be written on their own line
  4.    They end with a semicolon
 Discuss Question
Answer: Option D. -> They end with a semicolon


They end with a semicolon


Question 7. The difference between x and 'x' is
  1.    The first one refers to a variable whose identifier is x and the second one refers to the character constant x
  2.    The first one is a character constant x and second one is the string literal x
  3.    Both are same
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> The first one refers to a variable whose identifier is x and the second one refers to the character constant x


The first one refers to a variable whose identifier is x and the second one refers to the character constant x


Question 8. How to declare a wide character in string literal?
  1.    L prefix
  2.    l prefix
  3.    W prefix
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> L prefix


It can turn this as wide character instead of narrow characters.


Question 9.

Regarding following statement which of the statements is true?

     const int a = 100;

  1.    Declares a variable a with 100 as its initial value
  2.    Declares a construction a with 100 as its initial value
  3.    Declares a constant a whose value will be 100
  4.    Constructs an integer type variable with a as identifier and 100 as value
 Discuss Question
Answer: Option C. -> Declares a constant a whose value will be 100


Because the const is used to declare non-changable values only.


Share this page with your friends!

Share this page with your friends!

Latest Videos

Chapter 1 - GLOBAL STEEL SCENARIO & INDI Part 1 : (13-04-2024) INDUSTRY AND COMPANY AWARENESS (ICA)
Direction Sense Test Part 1 Reasoning (Hindi)
Chapter 1 - RMHP / OHP / OB & BP Part 1 : (14-02-2024) GPOE 2024
Cube & Cuboid Part 1 Reasoning (Hindi)
Data Interpretation (DI) Basic Concept Reasoning (Hindi)
Counting Figures Part 1 Counting Of Straight Lines Reasoning (Hindi)
Real Numbers Part 7 Class 10 Maths
Real Numbers Part 1 Class 10 Maths
Polynomials Part 1 Class 10 Maths

Latest Test Papers

Chapter 1.1 : INTRODUCTION Chapter 1 : Raw Material Handling Plant GPOE/GPA 2024
Chapter 1.1 : Personnel Functions- An ov Chapter 1 : Personnel Management GFM 2024
Chapter 3.1 : INTRODUCTION Chapter 3 : Sinter Plant GPOE/GPA 2024
Chapter 2.3 : COAL HANDLING PLANT - Set Chapter 2 : Coke Ovens and Coal Chemicals GPOE/GPA 2024
Chapter 2.1 : Overview Chapter 2 : Materials Management GFM 2024