Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C++ code?
#include <iostream>
#include <cctype>
using namespace std;
int main(int argc, char const *argv[])
{
char arr[27] = “abcdefghijklmnopqrstuvwxyz”;
for(int i=0;i< 27;i++)
{
cout<<(bool)isxdigit(arr[i]);
}
}

What will be the output of the following C++ code?
#include <iostream>
#include <cctype>
using namespace std;
int main(int argc, char const *argv[])
{
char arr[27] = “abcdefghijklmnopqrstuvwxyz”;
for(int i=0;i< 27;i++)
{
cout<<(bool)isxdigit(arr[i]);
}
}
a) 111001100011110000000111100
b) 101010101010101001010101010
c) 111111000000000000000000000
d) 111111111000001111011110111

Answer: c
Explanation: In this program, we are checking the presence of hexadecimal characters in the string and as only a, b, c, d, e and f are used as hexadecimal characters therefore only first bits are 1 and others are 0.

Join The Discussion