Monday, 2 July 2012
Frequently Asked C Programming Questions in Interviews
C Programming Trick Questions
(1) What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf("%d %d %d",s.p,s.c,s.m);
}
(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
(d) Compiler error
(e) None of these
Answer: (c)
Explanation:
Binary value of 2: 00000010 (Select three two bit)
Binary value of 6: 00000110
Binary value of -6: 11111001+1=11111010
(Select last three bit)
Binary value of 5: 00000101 (Select last two bit)
Write a c program to create dos command directory
Write a c program to create dos command: dir.
Answer:
Step 1: Write following code.
#include “stdio.h”
#include “dos.h”
void main(int count,char *argv[]){
struct find_t q ;
int a;
if(count==1)
argv[1]="*.*";
a = _dos_findfirst(argv[1],1,&q);
if(a==0){
while (!a){
printf(" %s\n", q.name);
a = _dos_findnext(&q);
}
}
else{
printf("File not found");
}
}
Sunday, 1 July 2012
3-1 cse/it textbooks download for jntuk, jntuh
1) Principles Of Programming Languages
Concepts of Programming Languages Robert .W. Sebesta
Programming languages –Watt
Programming languages –Watt
2) Operation Research
3) Software Engineering
Software Engineering,A practitioner’s Approach- Roger S. Pressman
4) Compiler Design
Compilers Principles Techniques & Tools Aho Sethi Ullman
Subscribe to:
Posts (Atom)








