What is the output of the code given below? [code] void setup() { Serial.begin(9600); } void loop() { String s=String(13,HEX);

Đức Lưu

New member
What is the output of the code given below?
Code:
void setup() {
     Serial.begin(9600);
}
void loop() {
    String s=String(13,HEX);
    Serial.println(s);
}
A. 13
B. A
C. B
D. D
 
Answer: D
Explanation: The program above makes use of the String() function to convert the given number into a string. The String() function takes a maximum of 2 arguments; the number, and the base. Here the number 13 is given a base HEX which means it’s a hexadecimal number which makes it D.
 

Tìm kiếm

Back
Top