IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Const (2)

  • Home
  • Computer Science & Engineering
  • C Programming Questions and Answers
  • Const
9. 

What will be the output of the program?

#include<stdio.h>
#include<stdlib.h>

union employee
{
char name[15];
int age;
float salary;
};
const union employee e1;

int main()
{
strcpy(e1.name, "K");
printf("%s %d %f", e1.name, e1.age, e1.salary);
return 0;
}

A. Error: RValue required
B. Error: cannot convert from 'const int *' to 'int *const'
C. Error: LValue required in strcpy
D. No error

Answer: Option D

Explanation:

The output will be (in 16-bit platform DOS):

K 75 0.000000

View Answer Discuss Workspace Report

10. 

What will be the output of the program?

#include<stdio.h>

int main()
{
    int y=128;
    const int x=y;
    printf("%d\n", x);
    return 0;
}
A. 128
B. Garbage value
C. Error
D. 0

Answer: Option A

Explanation:

Step 1: int y=128; The variable 'y' is declared as an integer type and initialized to value "128".

Step 2: const int x=y; The constant variable 'x' is declared as an integer and it is initialized with the variable 'y' value.

Step 3: printf("%d\n", x); It prints the value of variable 'x'.

Hence the output of the program is "128"

View Answer Discuss Workspace Report

  • 1
  • 2

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2025 IndiaBIX. All Rights Reserved.

Report