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

Ngô Quốc Huy

New member
What is the output of the code given below?
Code:
void setup() {
    Serial.begin(9600);
}
void loop() {
    String s=String(13,BIN);
    Serial.println(s);
}
A. 13
B. 1101
C. 1001
D. null
 
Answer: B
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 BIN which means it’s a binary number which makes it 1101.
 

Tìm kiếm

Back
Top