Question
Download Solution PDFWhat will be the output of the following code?
# include < sidio. h >
int main ( ) {
int a, b, c;
a = ox10; b = o10;
c = a + b:
printf ("%d", c);
return 0;
}
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is 24
EXPLANATION:
#include <stdio.h>
int main() {
int a, b, c;
a = 0x10; / Hexadecimal notation for 16
b = 010; / Octal notation for 8
c = a + b;
printf("%d", c);
return 0;
}
0x10 is a hexadecimal representation which is equivalent to 16 in decimal and 010 is an octal representation which is equivalent to 8 in decimal.
So, c = a + b calculates as c = 16 + 8.
Hence, the output will be 24.
Last updated on Jun 6, 2025
-> The UGC NET Exam Schedule 2025 for June has been released on its official website.
-> The UGC NET Application Correction Window 2025 is available from 14th May to 15th May 2025.
-> The UGC NET 2025 online application form submission closed on 12th May 2025.
-> The June 2025 Exam will be conducted from 21st June to 30th June 2025
-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.
-> The exam is conducted bi-annually - in June and December cycles.
-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions.
-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.