C Programming Que. paper.
I want to share some of the questions from my 3rd sem exam of C language.
Sharing ALL questions is not possible. (Most of them are easy)
Q1. Distinguish between (*m)[5] and *m[5]?
Q2. What is UNION? How it is different from STRUCTURE?
Q3. Distinguish between syntax and semantic error?
Q4. What do you mean by Input/Output stream?
Q5. Find the output of the program:
main()
{
Very easy questions!:smile:
Sharing ALL questions is not possible. (Most of them are easy)
Q1. Distinguish between (*m)[5] and *m[5]?
Q2. What is UNION? How it is different from STRUCTURE?
Q3. Distinguish between syntax and semantic error?
Q4. What do you mean by Input/Output stream?
Q5. Find the output of the program:
main()
{
int a=10, b=20, c=30, d;
d = a > b ? (a > c ? a : c) : b > c ? b : c;
printf ("%d",d);
}d = a > b ? (a > c ? a : c) : b > c ? b : c;
printf ("%d",d);
Very easy questions!:smile:
Replies
-
yadavundertaker mohitfor you they seems to be easy but for me like Schrödinger equation
-
Manish Goyal5😲utput of program will be 30
-
sarveshguptaif you know Structure you also know Union
they are collection of various data types but have a difference
The memory of Structure is equal to the sum of the memory of all the data types
But Union takes only the largest value only
Say we have a char, int then memory for structure will be 3 while Union it will be 2 -
sarveshguptaSyntax error is the error in the syntax that is use forget to follow the rules of writing code in C
it means you forget a ';' or make a spelling mistake of 'printf to be pintf'
Semantics are the logical errors they are generally not recognised by the compiler with exceptions of divide by zero
Semantics means you have done a+b when you had to do a+c -
gaurav.bhorkar
Can you give justification for your answer?goyal4205😲utput of program will be 30 -
gaurav.bhorkar@sarveshgupta
All your answers are correct. Good. -
Maelstrom
(*m)[5] means "pointer to an array of 5 integers"gaurav.bhorkarQ1. Distinguish between (*m)[5] and *m[5]?
*m[5] means "array of integer pointers"
As for the Input/Output stream question, I'm not sure, but I think that they are interfaces provided to the programmer to ensure that he does not have to worry about the actual implementation of input/output (i.e. writing individual bytes to printer or monitor etc.). -
sarveshguptaThanks Gaurav
And as far as input/output stream are concerned
Stream is an array of bytes
all the input output of the values is considered as a stream of bytes by the compiler
an int variable has 2 bytes , a char has 1 byte
When the input and output is performed it is considered as bytes -
Manish Goyalmain()
{int a=10, b=20, c=30, d;}
d = a > b ? (a > c ? a : c) : b > c ? b : c;
printf ("%d",d);
first of all it will check whether a>b ie not true so it check b>c which is again false
so it will give value 30
I hope my answer is not wrong -
gaurav.bhorkar
You are absolutely correct. Good Job!goyal420main()
{
int a=10, b=20, c=30, d;}
d = a > b ? (a > c ? a : c) : b > c ? b : c;
printf ("%d",d);
first of all it will check whether a>b ie not true so it check b>c which is again false
so it will give value 30
I hope my answer is not wrong -
gaurav.bhorkarI don't know about Input/Output stream.
Sarveshgupta may be correct. -
Gurjeet Singhmain()
{
printf("%%%%%",7);
}
what is the output:
1:7
2:error
3:%%%
4:%%%%% -
Saandeep SreerambatlaIt gives syntax error 😀
The bracket mustbe } not {
PS.Start new thread for questions 😀 -
sarveshguptaI think he has placed that bracket by mistake
and printf has everything inside double quotes except the variables whose values are to be substituted with their type specifiers
Hope i am correct
You are reading an archived discussion.
Related Posts
I have passed B.E (ICE) in anna univ. Im planning to do my M.S. (Research) for which Im looking for research topic. I prefer to do in one of the...
This is somewhat shocking to me. JAM (Just Another Magazine) magazine has reported that the credentials of IIM Shillong's director are questionable. The magazine reports:
No less than 7 of...
well, I have project for my grade 12 board exam in subject Informatics Practices. I have to make a inventory system and have to produce reports . For this I...
I have created a login form for connecting vb6 to oracle .The following code I have wrote in click event of button login.
Private Sub cmdlogin_Click()
Dim con As New...
If you're looking to monitor your network and Internet speed, track overall bandwidth usage, and get several other very useful utilities, you'd do well to download the free NetWorx. With...