#1
Which keyword is used to declare a character data type in C++?
char
ExplanationDeclares a character data type in C++.
#2
In Java, what is the default value of a char variable?
''
ExplanationThe default value of a char variable in Java is an empty character.
#3
What is the ASCII code for the lowercase letter 'a'?
97
ExplanationThe ASCII code for the lowercase letter 'a' is 97.
#4
Which of the following is a valid way to declare a character in C#?
char ch = 'A';
ExplanationDeclares and initializes a character 'A' in C#.
#5
Which character is used as an escape character in most programming languages?
\
ExplanationThe backslash character '\' is used as an escape character in most programming languages.
#6
In Java, how can you compare two char values for equality?
ch1 == ch2
ExplanationCompares two char values for equality using the '==' operator in Java.
#7
Which escape sequence is used to represent a newline character in C?
\n
ExplanationThe escape sequence '\n' in C is used to represent a newline character.
#8
Which character is used to represent the end of a string in C?
'\0'
ExplanationThe character '\0' is used to represent the end of a string in C.
#9
Which escape sequence is used to represent a backslash character in C++?
\\
ExplanationThe escape sequence '\\' in C++ is used to represent a backslash character.
#10
What is the size of a char data type in C programming?
1 byte
ExplanationA char data type in C programming occupies 1 byte of memory.
#11
Which escape sequence is used to represent a tab character in C#?
\t
ExplanationRepresents a tab character in C# using the escape sequence '\t'.
#12
In JavaScript, what is the method used to convert a string to an array of characters?
split()
ExplanationThe 'split()' method in JavaScript converts a string to an array of characters.
#13
Which of the following is a valid character literal in C++?
'A'
ExplanationThe character literal 'A' is valid in C++.
#14
What is the hexadecimal representation of the ASCII code for the digit '5'?
53
ExplanationThe hexadecimal representation of the ASCII code for the digit '5' is 53.
#15
In C#, which method is used to convert a character to its lowercase equivalent?
toLower()
ExplanationThe 'toLower()' method in C# is used to convert a character to its lowercase equivalent.
#16
In C++, what is the difference between 'char' and 'wchar_t' data types?
'wchar_t' is for wide characters and has a larger size
Explanation'wchar_t' in C++ is for wide characters and has a larger size compared to 'char'.
#17
What is the Unicode range for basic Latin characters?
U+0000 to U+007F
ExplanationThe Unicode range for basic Latin characters is U+0000 to U+007F.
#18
What is the purpose of the 'isalpha()' function in C?
Checks if a character is alphabetic
ExplanationThe 'isalpha()' function in C checks if a character is alphabetic.
#19
In Java, how can you concatenate two char variables 'ch1' and 'ch2'?
ch1 + ch2
ExplanationConcatenate two char variables 'ch1' and 'ch2' in Java using the '+' operator.
#20
In Python, how do you convert a character to its Unicode code point?
ord()
ExplanationIn Python, the 'ord()' function is used to convert a character to its Unicode code point.
#21
What is the purpose of the Unicode character encoding?
To represent characters using binary code
ExplanationUnicode character encoding is used to represent characters using binary code.
#22
What is the purpose of the 'chr()' function in Python?
Returns the Unicode character for the specified code
ExplanationThe 'chr()' function in Python returns the Unicode character for the specified code.
#23
In Python, what will the expression ord('A') - ord('a') evaluate to?
32
ExplanationThe expression ord('A') - ord('a') in Python will evaluate to 32.
#24
In Java, what will the expression 'char ch = 65; System.out.println(ch);' output?
A
ExplanationThe expression will output the character 'A' because the ASCII code 65 corresponds to 'A'.
#25
In Python, what will the expression chr(ord('A') + 1) evaluate to?
B
ExplanationThe expression chr(ord('A') + 1) in Python will evaluate to 'B'.