C
programming online test questions answers and explanation for freshers
These are objective type questions and answers for a C programming language online test or quiz, designed for interviews or written tests. If you have any queries or suggestions, please feel free to share them.
39 comments:
which one is standard compiler? turbo c dev c++ or lunix?
can anybody explain this???
#include
main()
{
int **p,q;
p = (int **)5;
q = 10;
printf("%d",q+p);
return 0;
}
linux of course.
i am a first year INFORMATION TECHNOLOGY student.at UE .this really help me to understand my course more..thank you :)
arr[ ]={4,5,8,8,4};
x=arr[1]+(arr[1]=2);
while executing this line which one should be executed first whether arr[ 1 ] or (arr[ 1 ]=2) helpme
In q6 the gcc compilers output is 110 . pls verify and tell us the reason
will you provide certificate for this test if we pass
so why turbo c preferred here
#include
int main(){
int a[]={10,20,30,40};
int i=3,x;
x=1*a[--i]+2*a[--i]+3*a[--i];
printf("%d",x);
return 0;
}
here the o/p is 100 but you have given the ans as 60 can u explain this for me
I suggest you refactor this test and allow for different compiler treatment of undefined cases and other moot points. FYI, some of your "Compilation errors" actually compile on my machine, int size is not specified by the standard, your float expression evaluation on my machine was actually not done as float and so on...
Its 100 Not 110.
chutiyo ans is 100 for sixth ques
Checking
yeaa :-/
ques no6 & 17 gives ans 100 and 14 according to devc++ compiler tell me which compiler i use to give correct ans of such complication...
que no 6
dev c++ is giving ans 130 how can it.can any one explain
dev c++ gives 130
first verify ur ans ,,lots of mistake
rishi kahila BANDA haichi
buzz of ur answers man.. so confusing answers honestly.
ok
Level is much better ...
Thanks...
firstly (arr[1]=2) must be taken bcoz () have more precedence than other
firstly (arr[1]=2) must be taken bcoz () have more precedence than other
Most of the above are useless questions - they hardly test practical C knowledge : Eg.
in Q8: val=sizeof (f(i)+ +f(i=1)+ +f(i-1)); and in Q11: num=-a--+ +++a; --> who in sound mind will be programming like that. This is insane.
Also, 'test questions' shall require little need for arithmetics : eg. in Q3 there is this : x= ... a<<a, and a is = 5. How on earth am I suposed to quickly calculate '5 left shifted by 5 places'. Stupid.
And for some questions, ALL proposed answers are incorrect. Eg. in Q3 the (tested using Borland compiler) the answer is 320 - and it is NOT listed.
in addition
number of questions has code with undefined/unspecific behavior and answers don't give that option
if u include proper header file than output is 85.
Pointer arithmetic cannot be performed on which pointer?
On void pointer because compiler doesn't know the size of the item on which void pointer is pointing to.
if u run this code in gcc compiler than u will get o/p 7..bcz arr[1] value compiler take at compile time after assign the value in arr[1]..so 5+2..
here compiler do optimization technique so its take latest value..compiler do optimization for faster execution....so its take i as 0..so 1*10+2*10+3*10=60
Answer of question 6 is 110 which is not in options.
Explanation : 1*a[0] + 2*a[1] + 3*a[2]
10 + 40 + 60=110
Question was :
#include
int main(){
int a[]={10,20,30,40};
int i=3,x;
x=1*a[--i]+2*a[--i]+3*a[--i];
printf("%d",x);
return 0;
}
hello anyone online can help me plzzz
#include
#define MAX 1000
int main(){
char binaryNumber[MAX],hexaDecimal[MAX];
long int i=0;
printf("Enter any hexadecimal number: ");
scanf("%s",hexaDecimal);
printf("\nEquivalent binary value: ");
while(hexaDecimal[i]){
switch(hexaDecimal[i]){
case '0': printf("0000"); break;
case '1': printf("0001"); break;
case '2': printf("0010"); break;
case '3': printf("0011"); break;
case '4': printf("0100"); break;
case '5': printf("0101"); break;
case '6': printf("0110"); break;
case '7': printf("0111"); break;
case '8': printf("1000"); break;
case '9': printf("1001"); break;
case 'A': printf("1010"); break;
case 'B': printf("1011"); break;
case 'C': printf("1100"); break;
case 'D': printf("1101"); break;
case 'E': printf("1110"); break;
case 'F': printf("1111"); break;
case 'a': printf("1010"); break;
case 'b': printf("1011"); break;
case 'c': printf("1100"); break;
case 'd': printf("1101"); break;
case 'e': printf("1110"); break;
case 'f': printf("1111"); break;
default: printf("\nInvalid hexadecimal digit %c ",hexaDecimal[i]); return 0;
}
i++;
}
return 0;
}
WHY USE A CHAR DATA TYPE TO STORE THE BINARY VALUE
In Linux GCC complier
Output: 90
Consider on expression:
= 1 * a[--i] + 2 * a[--i] + 3 * a[--i] //i = 3 - 2
= 1 * a[--i] + 2 * a[--i] + 3 * a[--i] //i = 2 - 1
= 1 * a[1] + 2 * a[1] + 3 * a[--i] //i = 1 - 1
= 1 * a[1] + 2 * a[1] + 3 * a[0]
= 1 * 20 + 2 * 20 + 3 * 10
= 20 + 40 + 30
= 90
i think this solution is wrong... can any one explain it...
gcc compiler output:100
nice post
Explanation : 1*a[2] + 2*a[1] + 3*a[0]
30 + 40 + 30=100
Question was :
#include
int main(){
int a[]={10,20,30,40};
int i=3,x;
x=1*a[--i]+2*a[--i]+3*a[--i];
printf("%d",x);
return 0;
}
Borgata Hotel Casino & Spa - MapYRO
Hotel AddressPhone/PhoneAddress: 020 Casino Drive, 정읍 출장마사지 Baltic, MA, 89022City: United StatesOpening hours: 4:00 a.m. | Fri, Dec 17Previous 당진 출장마사지 names: 광양 출장안마 Borgata Hotel Casino & Spa, 양산 출장마사지 $28 서산 출장샵 million
Post a Comment