UrbanPro
true

Learn C++ Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Interview Questions

Maulik Hinsu
27/07/2017 0 0

(1) What is the output of below program:

For(char i = 0; i<256; i++)
Printf(“%d\n”,i);

Modify above program so that it can prints number from 0 to 255.

(2) Consider on following declaration:

(i) short i=10;
(ii) static i=10;
(iii) unsigned i=10;
(iv) const i=10;

Choose correct one:
(A) Only (iv) is incorrect
(B) Only (ii) and (iv) are incorrect
(C) Only (ii),(iii) and (iv) are correct
(D) Only (iii) is correct
(E) All are correct declaration

(3) What will be output when you will execute following c code?


#include
int main(){
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf("%d",sizeof('A')); return 0;
}

Choose all that apply:

(A) 4 2 1
(B) 8 2 1
(C) 4 4 1
(D) 8 4 1
(E) 8 4 2

(4) What will be output when you will execute following c code?

#include
int main(){
int a= sizeof(signed) +sizeof(unsigned);
int b=sizeof(const)+sizeof(volatile);
printf("%d",a+++b); return 0;
}

Choose all that apply:
(A) 10
(B) 9
(C) 8
(D) Error: Cannot find size of modifiers
(E) Error: Undefined operator +++

(5) What will be output when you will execute following c code?

#include
int main(){
signed x,a;
unsigned y,b;
a=(signed)10u;
b=(unsigned)-10;
y = (signed)10u + (unsigned)-10;
x = y;
printf("%d %u\t",a,b);
if(x==y)
printf("%d %d",x,y);
else if(x!=y)
printf("%u %u",x,y); return 0;
}


Choose all that apply:

(A) 10 -10 0 0
(B) 10 -10 65516 -10
(C) 10 -10 10 -10
(D) 10 65526 0 0
(E) Compilation error

(6) What is the range of signed int data type in that compiler in which size of int is two byte?

(A) -255 to 255
(B) -32767 to 32767
(C) -32768 to 32768
(D) -32767 to 32768
(E) -32768 to 32767

(7) Which of the following data type is right in C programming?

A. Long long double
B. Unsigned long long int
C. Long double int
D. Unsigned long double

(8) Solve the Following:

#include

int main()
{
char num = '\010';
printf("%d", num);
return 0;
}


A. 010
B. 08
C. 10
D. 8

(9) Solve the Following: 

#include
int main()
{
void num=10;
printf("%v", num);
return 0;
}


A. Compilation error
B. 10
C. Garbage value
D. 0

(10) Solve the Following: 

 #include
int main()
{
extern int num;
num = 5;
printf("%d", num);
return 0;
}


A. Compilation Error
B. Linker error
C. Runtime error
D. 5

 

 

0 Dislike
Follow 1

Please Enter a comment

Submit

Other Lessons for You

Advantages of C++ Language
Advantages of C++ - C++ is a profoundly convenient dialect and is frequently the dialect of decision for multi-gadget, multi-stage application advancement. - C++ is a protest situated programming dialect...

Do You Know Size Of Empty Class and Reason?
Size of empty class is always 1 byte. Reason is, in order to differentiate one object to another object, the size of empty class is always 1 byte. See the below c++ code snippet. Here there are three...

Magic in C=> OFFSET OF MACRO in C [offsetof(TYPE, MEMBER)]
Here I am going to discuss an exciting macro in C. It will give you offset of a member within a structure. NULL or 0 address is typecasted to TYPE first. It won't result in segmentation fault as we are...

Is It Fine To Write “void main()” Or “main()” In C/C++?
The definition: void main() { /* ... */ } Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1 or the ISO C standard 5.1.2.2.1. A conforming...

C++ Advanced Course Study With C++11 Features
OOPS(Object Oriented Programming Systems) In C++. Types of Languages 2GL(Basic,Instruction programming to microprocessors/MC), 3GL(COBOL(= EQUALS TO),C++,C,PASCAL,Java,C#) 4GL(HTML,CSS,JSON) Style...
X

Looking for C++ Language Classes?

The best tutors for C++ Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C++ Language with the Best Tutors

The best Tutors for C++ Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more