- Home
- Placement
- Programming
- Structure & Union
- Array
- Data Types
- Functions
- Loop & Control Statements
- Operators & Expressions
- Pointer
- Preprocessor
- Storage Classes
- Structure & Union
- Variables & Constants
- Classes and Objects
- Consructors and Destructors
- Exception handling
- File Handling
- Function Overloading
- Inheritance
- Operator Overloading
- Polymorphism
- Templates
C Language
C++ language
JAVA
-
-
( 1 ) Which of the following comment about the usage of structures in true?
- 1) Storage class can be assigned to individual member
- 2) Individual members can be initialized within a structure type declaration
- 3) The scope of the member name is confined to the particular structure, within which it is defined
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 3) The scope of the member name is confined to the particular structure, within which it is defined
Solution : Structure is user defined data type which is used to store heterogeneous data under unique name.
discussion
Answer : 3) The scope of the member name is confined to the particular structure, within which it is defined
-
-
-
( 2 ) What is the output of this C code?
#include
struct student
{
char *name;
};
void main()
{
struct student s, m;
s.name = "st";
m = s;
printf("%s%s", s.name, m.name);
} - 1) Compile time error
- 2) Nothing
- 3) Junk values
- 4) st st
-
-
-
( 3 ) What is the correct syntax to declare a function foo() which receives an array of structure in function?
- 1) void foo(struct *var);
- 2) void foo(struct *var[]);
- 3) void foo(struct var);
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 1) void foo(struct *var);
Solution :
discussion
Answer : 1) void foo(struct *var);
-
-
-
( 4 ) What is the output of this C code?
#include
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
printf("%d", sizeof(s));
} - 1) 5
- 2) 9
- 3) 8
- 4) 10
-
-
-
( 5 ) What is the output of this C code?
#include
struct p
{
int k;
char c;
};
int p = 10;
int main()
{
struct p x;
x.k = 10;
printf("%d %d\n", x.k, p);
} - 1) Compile time error
- 2) 10 10
- 3) Depends on the standard
- 4) Depends on the compiler
-
-
-
( 6 ) For the following function call which option is not possible?
func(&s.a); //where s is a variable of type struct and a is the member of the struct. - 1) Compiler can access entire structure from the function.
- 2) Individual member's address can be displayed in structure.
- 3) Individual member can be passed by reference in a function.
- 4) Both 1 & 2
-
Show Answer Report Discussion in forumAnswer : 1) Compiler can access entire structure from the function.
Solution :
discussion
Answer : 1) Compiler can access entire structure from the function.
-
-
-
( 7 ) For what minimum value of x in a 32-bit Linux OS would make the size of s equal to 8 bytes?
struct temp
{
int a : 13;
int b : 8;
int c : x;
}s; - 1) 4
- 2) 8
- 3) 12
- 4) 32
-
-
-
( 8 ) Which of the following is not possible under any scenario?
- 1) s1 = &s2;
- 2) s1 = s2;
- 3) (*s1).number = 10;
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 4) None of these
Solution :
discussion
Answer : 4) None of these
-
-
-
( 9 ) What would be the size of the following union declaration?
#include
union uTemp
{
double a;
int b[10];
char c;
}u;
(Assuming size of double = 8, size of int = 4, size of char = 1) - 1) 4
- 2) 8
- 3) 40
- 4) 80
-
-
-
( 10 ) What is the output of this C code?
#include
struct student fun(void)
{
struct student
{
char *name;
};
struct student s;
s.name = "alan";
return s;
}
void main()
{
struct student m = fun();
printf("%s", m.name);
} - 1) Compile time error
- 2) alan
- 3) Nothing
- 4) Varies
-
Show Answer Report Discussion in forumAnswer : 1) Compile time error
Solution :
discussion
Answer : 1) Compile time error
-