
C-structures , bitfields,union and File Handling

Quiz
•
Professional Development
•
University
•
Hard
Shaik Imam
Used 3+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can the following C code be compiled successfully?
#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .f = 3, .k = 1};
printf("%f\n", x.f);
}
Depends on the standard
No
Depends on the platform
Yes
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code?
#include <stdio.h>
struct student
{
int no;
char name[20];
};
void main()
{
student s;
s.no = 8;
printf("%d",s.no);
}
Nothing
8
Compile time error
Junk
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)
#include <stdio.h>
union uTemp
{
double a;
int b[10];
char c;
}u;
4
8
40
80
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code
#include <stdio.h>
union temp
{
int a;
float b;
char c;
};
int main()
{
union temp s = {1,2.5,’A’};
printf("%c",s.c);
return 0;
}
'1'
Compilation error
'A'
Nothing
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8)
#include <stdio.h>
union utemp
{
int a;
double b;
char c;
}u;
int main()
{
u.c = 'A';
u.a = 1;
printf("%zu", sizeof(u));
}
8
4
1
13
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this program?
#include <stdio.h>
int main()
{
typedef struct tag {
char str[10];
int a;
} tag;
tag h1, h2 = { "IHelp", 10 };
h1 = h2;
h1.str[1] = 'h';
printf("%s, %d", h1.str, h1.a);
return 0;
}
Error
IHelp 10
Ihelp 10
No Error ,No output
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this program?
#include <stdio.h>
int main()
{
union test {
int i;
int j;
};
union test var = 10;
printf("%d, %d\n", var.i, var.j);
}
10,10
garbage values
Nothing
Compilation Error
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
ROUND 1

Quiz
•
University
17 questions
Python 1

Quiz
•
1st Grade - University
25 questions
Lenguaje "C"

Quiz
•
University
25 questions
PSeInt

Quiz
•
University
15 questions
Django #1 (basic)

Quiz
•
1st Grade - Professio...
20 questions
C Programming- Control statements

Quiz
•
University
20 questions
Basics of Python Programming Unit-1

Quiz
•
University - Professi...
20 questions
C programming

Quiz
•
University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade