Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
CPP All : Preprocessor Directives And Macros
Concept Notes and Resources
Concept Learning Code Sheets

#include directive – Preprocessor for header inclusion #4572

Understanding the purpose of include preprocessor

#define directive – Preprocessor for Names to constant replacement #4580

Understanding the purpose of #define pre-processor directive.

#define directive as Macros Expressions #4585

Understanding the purpose of #define pre-processor directive to be used as macros or use of replacement action for expressions

#define Macros Nesting #4587

Understanding how #define macros can be nested (use of one macros expression as a part of another macros expression)

Exam Papers Problems

Macro definition for array filling #5304

( As In Exam - CBSE12A-2017 )

Find and write the output of the following C++ program code:
Note: Assu

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

#define Diff(N1,N2) ((N1>N2)?N1-N2:N2-N1)
void main()
{
  int A,B,NUM[] = {10,23,14,54,32};
  for(int CNT =4; CNT>0; CNT--)
  {
    A=NUM[CNT];
    B=NUM[CNT-1];
    cout<<Diff(A,B)<<'#';
  }
}

 

Finding and removing Syntax Errors #5610

( As In Exam - CBSE12A-2016 )

Rewrite the following C++ code after removing any/all syntactical errors with

Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.

Note: Assume all required header files are already being included in the program.

#define Formula(a,b) = 2*a+b
void main()
{
  float X=3.2;Y=4.1;
  Z=Formula(X,Y);
  cout<<'Result='<<Z<<endl;
}

01C #5831

( As In Exam - CBSE12D-2015 )

Observe the following C++ code very carefully and rewrite it after removing

Observe the following C++ code very carefully and rewrite it after removing any/all syntactical errors with each correction underlined.
Note: Assume all required header files are already being included in the program.

#Define float Max=70.0;
void main()
{
  int Speed
  char Stop='N';
  cin>>Speed;
  if Speed>Max
    Stop='Y';
  cout<<Stop<<end;
}

01C-2015 #5933

( As In Exam - CBSE12A-2015 )

after removing any/all syntactical errors with each correction underlined.

after removing any/all syntactical errors with each correction underlined.
Note: Assume all required header files are already being included in the program.

#Define float MaxSpeed=60.5;
void main()
{
  int MySpeed
  char Alert='N' ;
  cin»MySpeed;
  if MySpeed>MaxSpeed
  Alert='Y' ;
  cout<<Alert<<endline;
}

01D #6012

( As In Exam - CBSE12D-2017 )

Find and write the output of the following C++ program code:
Note: Assu

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

#define Big(A,B) (A>B)?A+1:B+2
void main()
{
  char W[] = "Exam";
  int L=strlen(W);
  for(int i =0; i<L-1; i++)
     W[i] = Big(W[i],W[i+1]);
  cout<<W<<endl;
}

01C-2016 #6079

( As In Exam - CBSE12D-2016 )

Rewrite the following C++ code after removing any/all syntactical errors with

Rewrite the following C++ code after removing any/all syntactical errors with
each correction underlined.
Note: Assume all required header files are already being included in the program.

#define Equation(p,q) = p+2*q
void main()
{
  float A=3.2;B=4.1;
  C=Equation(A,B);
  cout<<'Output='<<C<<endl;
}


Quizzes

Concept Notes:1  Code Sheets:4  Exam Paper Problems:6  Quizzes:1
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back