[S2-SUMMATIVE] Summative Assessment 2 - CHAR AND STRING MANIPULATION REVIEWER

Create an engaging and colorful illustration that showcases elements of coding, such as snippets of code, keyboards, and strings, representing character manipulation in C++. It should evoke a sense of learning and challenge in programming.

Character and String Manipulation Quiz

Test your knowledge of character and string manipulation in C++ with this comprehensive quiz! Designed for students and developers alike, it covers essential functions and concepts that every programmer should know.

  • 30 multiple-choice questions
  • Enrich your understanding of C++ string handling
  • Perfect for revision or self-assessment
30 Questions8 MinutesCreated by CodingStar912
Check if a character is a control character
iscntrl()
isdigit()
isspace()
Isalpha()

What is the error in the following program?

#include <cstring>

#include <iostream>

using namespace std;

int main ()

{

  char key[] = "apple";

  char buffer[80];

  do {

     cout << "Guess my favorite fruit? ";

     cin.getline(buffer,80);

  } while (strcmp (key,buffer) != 0);

  cout << "Correct answer!"

  return 0;

}

Semicolon is missing
Namespace is wrong
Missing library
The cout command is wrong
Converts highercase letter to lowercase
islower()
lower()
tolower()
ToLower()
Which of the following is correct?
cin.getlines(str,80);
Cin.getline(str,80);
cin.getline(str,80);
cin.Getline(str,90)

What is the output of the given program?

#include <iostream>

#include <ctype.h>

int main ()

{

  int i=0;

  char str[]="first line \n second line \n";

  while (!iscntrl(str[i]))

  {

    putchar (str[i]);

    i++;

  }

  return 0;

}

First
error
second line
first line
Which of the following is NOT a cstring function?
sqrt()
strcat()
strncpy()
strcpy()
This header declares a set of functions to classify and transform individual characters.
iostream
math.h
cstdlib.h
ctype.h
Check if a character is an uppercase letter
isupper()
Isupper()
isxdigit()
toupper()

Check the following program

#include <iostream>

#include <ctype.h>

using namespace std;

int main ()

{

  int I;

  char str[]="c3po...??";

  i=0;

  while (isalnum(str[i])) i++;

  cout << "The first " << I << " characters are alphanumeric.\n";

  return 0;

}

What is the value of i?

error
5
3
4
It represents a single letter
character
string
constant
Boolean
What is the identifier given to string class to declare string objects?
String
STRING
str
string
It converts a numerical value to string?
string
toupper
Tolower
to_string

What is the output of the given program?

#include <iostream>

#include <string>

using namespace std;

int main ()

   {

       string a = "Jessica ";

       a += "Jones";

       cout << a;

       return 0;

   }

JessicaJones
Jessica Jones
Jessica
Error
If two strings are identical, then the strcmp() function returns:
-1
Error
1
0

What is the output of the given program?

#include <iostream>

#include <string>

using namespace std;

int main ()

{

    string str1 = "";

    cout << str1.empty();

   return 0;

}

1
Error
0
Blank

What is the output of the following program?

#include <iostream>

#include <string>

using namespace std;

int main()

{

                string s1 = "Hello";

                string s2 = "Programming";

                cout<< s1 + " " + s2 + "!";

                return 0;

}

HelloProgramming
Hello Programming!
HelloProgramming!
Hello Programming

What is the output of the given program?

#include <cstring>

#include <iostream>

using namespace std;

int main()

{

char str1 []= "Bianca";

char str2 []= "Bianca";

cout << strcmp(str1, str2);

return 0;

}

Yes
True
-1
0

#include <iostream>

#include <string>

using namespace std;

int main ()

{

    string str1 = "This is a test";

    cout << str1.empty();

   return 0;

}

OUTPUT:  _______

Blank
0
1
Error
Returns true if character expression is either a letter or a digit otherwise false
Isalnum ()
Isalpha()
Isdigit()
Isspace()
Which of the following function allows you to read on a character?
Getline()
Strcpy()
Get()
Put()
Which of the following is correct?
Chars s;
CHAR s;
Char s;
Char s;

What is the output of the given program?

#include <iostream>

#include <ctype.h>

int main ()

{

  int i=0;

  char str[]="first line ";

  return 0;

}

first line
FIRST LINE
blank screen
Error
A function used to concatenate strings
Strncpy()
Strcat()
Strlen()
Strcpy()
Which of the following is used to read a line of input?
Getline()
Strlen()
Strcmp()
Strcat()
Returns true if character expression is a digit 0 through 9 otherwise false
Isdigit()
Isalnum()
Isspace()
Isalpha ()
Compares the C string str1 to the C string str2
Iscorrect()
Strcmp()
Isalpha()
Isalnum()
Converts lowercase letter to lowercase
lower()
tolower()
islower()
ToLower()
Check if a character is blank
Isalnum()
Isblank()
Isalpha()
Isgraph()
Which of the following operator can be used also in strings?
+
-
@
>

What is the output of the following program?

#include <iostream>

#include <string>

using namespace std;

int main () {

    string myString = "Hello";

    cout << myString[0];

   return 0;

}

Error
Blank Output
0
H
{"name":"[S2-SUMMATIVE] Summative Assessment 2 - CHAR AND STRING MANIPULATION REVIEWER", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of character and string manipulation in C++ with this comprehensive quiz! Designed for students and developers alike, it covers essential functions and concepts that every programmer should know.30 multiple-choice questionsEnrich your understanding of C++ string handlingPerfect for revision or self-assessment","img":"https:/images/course4.png"}
Powered by: Quiz Maker