Question 1
What is a character in programming?
1
A method to format strings
2
A single letter, digit or symbol represented in a programming language
3
A type of variable that stores numeric values
4
A function that manipulates text
Question 2
In C and Java, how are character literals represented?
1
Enclosed in curly braces (e.g. {A})
2
Enclosed in double quotes (e.g. "A")
3
Enclosed in single quotes (e.g. 'A')
4
No special representation is required
Question 3
What is the ASCII value of the character 'A'?
1
65
2
64
3
32
4
97
Question 4
Which of the following statements about Unicode is true?
1
Unicode is limited to 8 bits
2
Unicode can represent characters from all languages
3
Unicode only supports English characters
4
ASCII is more comprehensive than Unicode
Question 5
What is the Unicode representation of the character 'A'?
1
\u0043
2
\u0042
3
\u0041
4
\u0040
Question 6
Which encoding format supports emoji characters?
1
UTF-8
2
EBCDIC
3
ANSI
4
ASCII
Question 7
What will be the output of the following C++ code?
#include <iostream> #include <string> #include <cstring> using namespace std; int main(int argc, char const *argv[]) { const char *a = "Hello\0World"; cout<<a; return 0; }
1
World
2
Error
3
Hello
4
Hello World
Question 8
What is the minimum value that can be stored in a char variable in Java?
1
'a'
2
0
3
-128
4
-32768
Question 9
What is the default value of a boolean array element in Java if it's not explicitly initialized?
1
null
2
0
3
false
4
true
Question 10
Which of the following is not a valid way to declare a char variable in Java?
1
char x = 'a'
2
char w = 0x0041
3
char x = 'M'
4
char x = 64
Question 11
Which data type is used to store a single character in Java?
1
Character
2
String
3
char
4
character
Question 12
In Python, which function is used to get the ASCII value of a character?
1
ascii()
2
ord()
3
chr()
4
asc()
Question 13
What will be the output of the following Python code?
print(chr(66))
1
A
2
B
3
66
4
b
Question 14
In Java, what is the default value of a char variable?
1
null
2
' '
3
0
4
'\u0000'
Question 15
What will be the output of the following Python code?
print(ord('z') - ord('a'))
1
26
2
24
3
25
4
-25
Question 16
In JavaScript, which method is used to get the Unicode of a character?
1
getCode()
2
charCodeAt()
3
asciiCodeAt()
4
codeAt()
Question 17
In Python, which function converts an integer ASCII value to its corresponding character?
1
convert()
2
chr()
3
asc()
4
ord()
Question 18
What is the value of '1' + 1 in JavaScript?
1
NaN
2
TypeError
3
11
4
2
Question 19
What will be the output of 'A' + 1 in Python?
1
66
2
A1
3
TypeError
4
B
Question 20
In C++, which of the following correctly initializes a char array?
1
char arr[5] = "Hello";
2
char arr[] = "Hello";
3
char arr[] = {'H', 'e', 'l', 'l', 'o'};
4
Both 2 and 3
Question 21
What is the output of the following Java program?
System.out.println('A' + 1);
1
66
2
B
3
A1
4
Compilation Error