ExamVeda
Login
Home
81
What will be the output of the following C code?
#include <stdio.h>
enum example {a = 1, b, c};
enum example example1 = 2;
enum example answer() 
{
    return example1;
}
 
int main()
{
   (answer() == a)? printf("yes"): printf("no");
   return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
82
Point out the error (if any) in the following C code?
#include<stdio.h>
enum hello
{
    a,b,c;
};
main()
{
    enum hello m;
    printf("%d",m);
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
83
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = -2;
    if (!0 == 1)
        printf("yes\n");
    else
        printf("no\n");
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
84
String handling functions such as strcmp(), strcpy() etc can be used with enumerated types.
Discuss
Answer & Solution
Answer: Option B
Solution:
Enumerated types (enums) in C are used to give names to integer constants. For example:
enum days {MON, TUE, WED, THU, FRI, SAT, SUN};
This creates an enum named days where MON is assigned 0, TUE is 1, and so on.

String handling functions like strcmp() and strcpy() work with strings, which are arrays of characters (char). They don't directly work with enum types.

You cannot directly use strcmp() to compare two enum values because strcmp() expects character arrays, not integer values that enums represent. Similarly, you cannot copy an enum value using strcpy().

Therefore, the statement "String handling functions such as strcmp(), strcpy() etc can be used with enumerated types" is False.
85
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int y = 1, x = 0;
    int l = (y++, x++) ? y : x;
    printf("%d\n", l);
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
86
The name of the variable used in one function cannot be used in another function.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
87
Do logical operators in the C language are evaluated with the short circuit?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
88
Which operators of the following have same precedence?
P. "!=", Q. "+=", R. "<<="
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
89
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 0, y = 2;
    if (!x && y)
        printf("true\n");
    else
        printf("false\n");
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
90
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    if (~0 == 1)
        printf("yes\n");
    else
        printf("no\n");
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board