Vous êtes sur la page 1sur 3

QUESTION PAPER- C/C++

SET NO: 1

1.Comment on the output of this C code? #include <stdio.h> int main() { float f1 = 0.1; if (f1 == 0.1) printf("equal\n"); else printf("not equal\n"); } a) equal b) not equal c) Output depends on compiler

d) None of the mentioned

2. Applications of multidimensional array are? a) Matrix-Multiplication b) Minimum Spanning Tree c) Finding connectivity between nodes d) All of the mentioned 3.main( ) { unsigned int i=3; while( i .=0) printf( "%d", i--); } how many times will the printf stmt be executed? a)0 b)3 c)4 d) infinite 4.What is mutex? a) binary semaphore

b)multitasking facility

c) bit addressable memory

d) register

5.Which of the following statements is true on demand paging a)used to Increase speed of memory access b)causes external fragmentation. c)technique to mange existing main memory efficiently d)allows variable sized segments. 6. Main() { Const int val=5; Const int *ptrval; Ptrval=&val; *ptrval=10; Printf(%d,val); } a. 5 b. 10 c. Garbage d. Error 7.char *p; short i; long l;

QUESTION PAPER- C/C++

SET NO: 1

(long)i= l; a. both 1 & 2 are correct; b. both 1 &2 are incorrect. c. Statm 1 is correct. d. Statm 2 is correct. 8. Difference b/w c++ struct and c++ class is a. both are same. b. Struct defaults to public member access while class defaults to private member access. c. Struct defaults to public base class inheritance while class defaults to private base class inheritance. d. B & C. 9.void main(void) { FILE *p; p=fopen(c:\tc\trial, w); if(!fp) { Exit(0); } Fclose(p); a. fopen() not used correctly

b. path should be C:\tc\trial c. file pointer incorrect d. error

10.Which of the following is not modifier of data type in c? a.Extern b.extern c.huge d.all 11. What will be output when you will execute following c code? #include<stdio.h> int main(){ volatile int a=11; printf("%d",a); return 0; } a.11 b.garbage c.-2 d.we cannot predict

12.Which of the following library is used to do vector arithmetic? a) Boost b) Time c) OpenGL d) None of the mentioned 13. What is the output of this program in the text file? #include <stdio.h> int main () { FILE * p; char buffer[] = { 'x' , 'y' , 'z' }; p = fopen ( "myfile.txt" , "wb" ); fwrite (buffer , 1 , sizeof(buffer) , p );

QUESTION PAPER- C/C++

SET NO: 1

fclose (p); return 0; } a) xyz b) zyx c) yxz d) None of the mentioned. 14. Which of the following statements is correct? A. First time method of a class is called, the constructor method is called. B. Every time method of a class is called, the constructor method is called. C. Every time an instance of a class is created, the constructor method is called. D. None of the above 15.Which of the things does not require instantiation? a) functions b) non virtual member function c) member class d) all of the mentioned 16.In which type of semantics does c++ implements iterator? a) Memory b) Size c) Pointer d) None of the mentioned 17.What is the output of this program? #include <iostream> #include <string> using namespace std; int main() { string s = "a long string"; s.insert(s.size() / 2, " * "); cout << s << endl; return 0; } a) a long* string b) a long st*ring c) Depends on compiler d) None of the mentioned 18.What is the use of clog? a) Standard logging stream b) Error stream c) Input stream d) None of the mentioned 19.Where does the return statement returns the execution of the program? a) main function b) caller function c) same function d) none of the mentioned 20. setprecision requires which of the following header file? a) stdlib.h b) iomanip.h c) console.h d) conio.h

Vous aimerez peut-être aussi