Login


Lost your password?

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


Shop
CPP All : Functions (Built-in)
Concept Notes and Resources
Concept Learning Code Sheets

Math functions – sqrt/ pow/ log/ log10 #2127

See the working of some common math functions like sqrt, pow, log and log10

Basic Trigonometric functions #2130

Using trigonometric functions like sin, cos and tan etc. in c++

Maths – Rounding and related Functions #2135

Rounding and related functions like ceil, floor, round, rint, trunc etc. in c++

Absolute value functions abs() fabs() #2137

Using absolute value functions like fabs() and abs().

fmod( ) – Modulus function for fractions #2143

Using the specially created modulus function fmod() for fractions like float and double data type.

modf() – Function to separate integer and fraction part #2145

Using the modf() function to separate the integer and fraction part of fractional value.

Uppercase/lowercase and vice-versa conversion of alphabets #2147

Using toupper() and tolower() function for character level conversion in its ascii integer form.

Check character group as alpha, digit, control, punctuation, lower, upper etc. #2150

Check for character grouping in the ascii 7 bit range of control character, digit, punctuation, alphabet, alphanumeric, lowercase, uppercase, printable, graphical, white space etc.

getchar() putchar() : C-Style character level console I/O functions #2155

The functions which are frequently used in C, getchar() and putchar() provide a feature of character level console input and output facility.

get() put() functions of stream I/O #2160

Using get() and put functions of I/O stream methods like cin and cout.

getline() and write() functions of stream I/O #2175

Use of functions getline() and write of cin and cout steam I/O objects.

Finding required libraries based on functions used #5607

Ronica Jose has started learning C++ and has typed the following program. When she compiled the following code written by her, she discovered that she needs to include some header files to successfully compile and execute it. Write the names of those header files, which are required to be included in the code.

void main()
{
  double X,Times,Result;
  cin>>X>>Times;
  Result=pow(X,Times);
  cout<<Result<<endl;
}

Solved Problems

Print next alphabet if possible #2157

Write a c++ program to collect an alphabet from the user and then print the n

Write a c++ program to collect an alphabet from the user and then print the next alphabet using the getchar(),  putchar() and isalpha() functions. Give suitable error message if next character is not an alphabet or the given entry by the user is not an alphabet.

Count punctuation in user given text stream (using get) #2167

Write a program to find punctuation in the user given text data. Use the func

Write a program to find punctuation in the user given text data. Use the function ispunct() for finding punctuation and use get() function of cin method to collect the user given text matter in a loop.

Count punctuation in user given text stream (using getline) #2173

Write a program to find punctuation in the user given text data. Use the func

Write a program to find punctuation in the user given text data. Use the function ispunct() for finding punctuation and use getline() function of cin method to collect the user given text matter in a loop.

Output Writing – isupper(), islower, isalpha() #2677

Write output of the following program.

Write output of the following program.

Sum of integer array #3088

Write a program to collect 5 integer values from user in an integer array an

Write a program to collect 5 integer values from user in an integer array and then pass this array to a function along with its size. Return the sum of the array members from the function and print its value in the main routine.

Marking header files #4445

Mark the name of required C++ header files for each of the following function

Mark the name of required C++ header files for each of the following functions
strlen
getline
exit(0)
tolowerfloor

 

Output writing – Possible Random Numbers #5224

( As In Exam - CBSE12A-2018 )

Look at the following C++ code and find the possible output(s) from the optio

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the highest and lowest values that can be assigned in the array A.
Note :
● Assume all the required header files are already being included in the code.
● The function random(n) generates an integer between 0 and n-1.

 

void main()
{
  randomize();
  int A[4], C;
  for(C=0; C<4; C++)
  A[C]=random(C+1)+10;
  for(C=3; C>=0; C--)
  cout<<A[C]<<"@";
}

 

(i)   13@10@11@10@             (ii)   15$14$12$10$
(iii) 12@11@13@10@             (iv)  12@11@10@10@

Required header files #5300

( As In Exam - CBSE12A-2017 )

Anil typed the following C++ code and during compilation he found three error

Anil typed the following C++ code and during compilation he found three errors as follows:
(i) Function strlen should have prototype
(ii) Undefined symbol cout
(iii) Undefined symbol endl
On asking, his teacher told him to include necessary header files in the code. Write the names of the header files, which Anil needs to include, for successful compilation and execution of the following  code

void main()
{
  char Txt[] = "Welcome";
  for(int C= 0; C<strlen(Txt); C++)
    Txt[C] = Txt[C]+1;
    cout<<Txt<<endl;
}

Finding hypotenuse of a right angled triangle #5328

Write a program to print hypotenuse of a right angled triangle if base and h

Write a program to print hypotenuse of a right angled triangle if base and height of the triangle is given by the user.

comparing ceil, floor, round, abs function values #5330

Which of the following math function will return the lowest number as output

Which of the following math function will return the lowest number as output. Also write output of all functions.

(i) ceil(5.1)
(ii) floor(5.9)
(iii) round(5.99)
(iv) abs(-6)

Output writing – Possible Random Numbers Series #5591

Go through the C++ code below and find out the possible outputs from the sugg

Go through the C++ code below and find out the possible outputs from the suggested options (i) to (iv). Assume all the required header files are already being included in the code.

void main()
{
  const int LOW=25;
  randomize();
  int p=5, number;
  for(int i=1; i<=4; i++)
  {
    number=LOW+random(p);
    cout<<number<<":";
    p--;
  }
}

(i)   29:26:25:25:             (ii)   24:28:25:26
(iii) 29:26:24:28             (iv)  29:26:25:25:

Finding required libraries based on functions used #5607

( As In Exam - CBSE12A-2016 )

Ronica Jose has started learning C++ and has typed the following program. Whe

Ronica Jose has started learning C++ and has typed the following program. When she compiled the following code written by her, she discovered that she needs to include some header files to successfully compile and execute it. Write the names of those header files, which are required to be included in the code.

void main()
{
  double X,Times,Result;
  cin>>X>>Times;
  Result=pow(X,Times);
  cout<<Result<<endl;
}

01B #5828

( As In Exam - CBSE12D-2015 )

Observe the following program very carefully and write the names of those he

Observe the following program very carefully and write the names of those header file(s), which are essentially needed to compile and execute the following program successfully:

typedef char TEXT[80];
void main()
{
  TEXT Str[] = "Peace is supreme";
  int Index=0;
  while (Str[Index]!='\0')
    if (isupper(Str[Index]))
    Str[Index++]='#';
    else
  Str[Index++]='*';
  puts(str);
}

01F #5840

( As In Exam - CBSE12D-2015 )

Study the following program and select the possible output(s)from the option

Study the following program and select the possible output(s)from the option (i) to (iv) following it. Also write the maximum and the minimum values that can be assigned to the variable NUM.
Note:

– Assume all required header files are already being includedin the program.
– random(n) function generates an integer between 0 and n-1.

void main()
{
  randomize();
  int NUM;
  NUM=random(3)+2;
  char TEXT[]=”ABCDEFGHIJK”;
  for (int I=1;I<=NUM; I++)
  {
    for (int J=NUM;J<=7;J++)
    cout<<TEXT[J];
    cout<<end1;
  }
}
(i)FGHI    (ii) BCDEFGH   (iii) EFGH   (iv) CDEFGH
   FGHI         BCDEFGH         EFGH        CDEFGH
   FGHI                         EFGH
   FGHI                         EFGH

01B-2015 #5931

( As In Exam - CBSE12A-2015 )

Observe the following program very carefully and write the name of those head

Observe the following program very carefully and write the name of those header file (s), which are essentially needed to compile and execute the following program successfully:

typedef char STRING[80];
void main()
{
STRING Txt[] = “We love Peace”;
int Count=0;
while (Txt[Count]!=’\0′)
if (isalpha(Txt[Count]))
Txt[Count++]=’@’ ;
else
Txt[Count++]=’#’ ;
puts (Txt) ;
}

01F-2015 #5940

( As In Exam - CBSE12A-2015 )

Study the following program and select the possible output(s) from the optio

Study the following program and select the possible output(s) from the option (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable VAL.
Note:
- Assume all required header files are already being included inthe program.
- random(n) function generates an integer between 0 and n-1.

void main()
{
  randomize();
  int VAL;
  VAL=random(3)+2;
  char GUESS[]="ABCDEFGHIJK";
  for (int I=l;I<=VAL;I++)
{
  for(int J=VAL;J<=7;J++)
  cout«GUESS[J];
  cout«endl;
}
}


(i)       (ii)      (iii)      (iv)
BCDEFGH   CDEFGH    EFGH       FGHI
BCDEFGH   CDEFGH    EFGH       FGHI
                    EFGH       FGHI
                    EFGH       FGHI

01B-2017 #6006

( As In Exam - CBSE12D-2017 )

Anil typed the following C++ code and during compilation he found four errors

Anil typed the following C++ code and during compilation he found four errors as follows:
(i) Function strlen should have a prototype
(ii) Undefined symbol cout
(iii) Undefined symbol endl
(iv) Function getchar should have a prototype
On asking his teacher told him to include necessary header files in the code.
Write the names of the header files, which Anil needs to include, for successful compilation and execution of the following code:

void main()
{
  char S[] = "Hello";
  for(int i = 0; i<strlen(S); i++)
  S[i] = S[i]+1;
    cout<<S<<endl;
  getchar();
}

01F #6018

( As In Exam - CBSE12D-2017 )

Look at the following C++ code and find the possible output(s) from the optio

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum values that can be assigned to each of the variables R and C.
Note:
– Assume all the required header files are already being included in the code.
– The function random(n) generates an integer between 0 and n-1

void main()
{
  randomize();
  int R=random(3),C=random(4);
  int MAT[3][3] = {{10,20,30},{20,30,40},{30,40,50}};
  for(int I=0; I<R; I++)
  {
    for(int J=0; J<C; J++)
      cout<<MAT[I][J]<<" ";
    cout<<endl;
  }
}

01B-2016 #6077

( As In Exam - CBSE12D-2016 )

Jayapriya has started learning C++ and has typed the following program. When

Jayapriya has started learning C++ and has typed the following program. When she compiled the following code written by her, she discovered that she needs to include some header files to successfully compile and execute it. Write the names of those header files, which are required to be included in the code.

void main()
{
  float A,Number,Outcome;
  cin>>A>>Number;
  Outcome=pow(A,Number);
  cout<<Outcome<<endl;
}

01F-2016 #6146

( As In Exam - CBSE12D-2016 )

Look at the following C++ code and find the possible output(s) from the optio

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable CHANGER.
Note:
– Assume all the required header files are already being included in the code.
– The function random(n) generates an integer between 0 and n-1

void main()
{
  randomize();
  int CHANGER;
  CHANGER=random(3);
  char CITY[][25]={”DELHI”,”MUMBAI”,”KOLKATA” ,”CHENNAI”};
  for(int I=0;I<=CHANGER;I++)
  {
    for(int J=0;J<=I;J++)
    cout<<CITY[J];
    cout<<endl;
  }
}
(i) (ii)
DELHI

DELHIMUMABAI

DELHIMUMABAIKOLKATA

DELHI

DELHIMUMABAI

DELHIMUMABAIKOLKATA

DELHIMUMABAIKOLKATACHENNAI

(iii) (iv)
MUMABAI

MUMABAIKOLKATA

MUMABAIKOLKATACHENNAI

KOLKATA

KOLKATACHENNAI


Concept Notes:1  Code Sheets:12  Solved Problems:20 
×
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