0% found this document useful (0 votes)
16 views

Bankprogramming

Bank programming

Uploaded by

adelino
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
16 views

Bankprogramming

Bank programming

Uploaded by

adelino
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
1. Which of the following is the correct syntax of including a user defined header files in C++? a) finclude b) #include p ude “userdefined' 4) include [userdefined] 2. Which of the following is a correct identifier in C++? a) 7var_name b) 7VARNAME ToLVAR 1234 4) svar_name 3, Which of the following is used for comments in C+? a) // comment b) /* comment */ el both // comment or /* comment */ 4) // comment */ 4.Which of the following escape sequence represents tab? alt by \tir cob d)\a ‘Which of the following is called insertion/put to operator? alec b> a> d< 6.Which of the following is called extraction/get from operator? ae o> ae 7.CHis 2) procedural programming language b) object oriented programming language €) functional programming language 1) both procedural and object oriented programming language 8. In which part of the for loop termination condition is checked? for(i) {iv} all by au av ‘9.What will be the output of the following C++ code? #include using namespace std; int main() intx cout << ix << endl; } return 0; 1 a b)2 a3 4) 123 10.What will be the output of the following C++ code? include int main() { cout<<"Hello World"; return 0; 3 a) Hellow World 2b) Compile-time error ) Run-time error 4) Segmentation fault ‘L1.Which type is best suited to represent the logical values? a) integer, b)boolean €) character d) float 12.The value 192.54 can be represented using which data type? a) double b) void Clint 4) boot 18.Given the variables p, q are of char type and r,s, t are of int type. Select the right statement? Lte(rts)/ (res); 2.t=(p*a)/(r+5); a) Lis true but 2is false b) 1is false and 2s true “cL both 1 and 2 are true 4) both 1 and 2 are false 14.What will be the output of the following C++ code? include using namespace std; int main) int 1=1/-2; int k= 156-2: cout << 1 << k; return 0; } a) compile time error cb)-11 gia 4) implementation defined 15.What will be the output of the following C++ code? include using namespace std; int main) i inta; +375 cout << a; return 0; 1 a3 b)20 025 4) 30 16.What will be the output of the following C++ code? include using namespace std; int main () ( int, y yo Hx te cout << x<< y; x25; Yee he: cout << x<< y; return 0; b) 736749 367497 4) 367597 17, What will be the output of the following C++ code? include using namespace std; main() { double a= 21.09399; float b = 10.20; inte,d: cout << c< using namespace std int main () { int for (n=5;n>0; n-) { cout << n; if(n==3) break; ) return 0; b)54 ) 5432 ¢)53 19.What will be the output of the following C++ code? include using namespace std int main) ( int 15; for (; cout using namespace std; int main) { inti: for (i= { cout << ] return 0; } a) 0123456789 b)10 012345678910 10; i++); 4) compile time error 21.Which looping process is best used when the number of iterations is known? tal for b) while ) do-while ¢) all looping processes require that the iterations be known 22.What's wrong? for {int k= 2, k<=12, k++) a) the increment should always be ++ b) the variable must always be the letter i when using a for loop €) there should be a semicolon at the end of the statement. 1d) the commas should be semicolons 23.Which looping process checks the test condition at the end of the loop? a) for b) while ‘1 do-while 4) no looping process checks the test condition at the end 24.The statement i++; is equivalent to abiziti; din 25. We can insert pre written code in a C++ program by using. a) fread b) # get ‘cl tinelude ¢) #put 26.What is a correct syntax to output "Hello World” in C+? a) System.out.printin( "Hello World”); b) ‘.cout << "Hello World “Hello World" 4d) cin >> "Hello World"; 27.Which escape character can be used to begin a new line in C+? al\a b)\M Xb “d)\n 28.Which data type is used to create a variable that should store text? a) String, *°b) string ©) mystring d) tet 29.Which of the following languages is a subset of C++ language? a) C language b) Java Language ) CH language 1d) none of the above 30.How do you create a variable with the numeric value 5? a) double x= *b) int ©) float x= 5; d) x5: 31.Which of the following shows the correct syntax for an if statement? expression b) if {expression Lif (expression 4) expression if 32.Which is valid C++ expression? ad int first_num = 55: b) int tnum = 55; )int first num = 55; 4d) int first_num = 55; 33.Which header file lets us work wit input and output objects? a) flinclude < iosstring> tb) include ) include 4) #include 34.Which operator is used to multiply numbers? ax by o& d)% :35.What symbol is used to state the beginning and the end of blocks of code ? a) (and) b) Land] *d) fand 36. f you forget to put a semicolon at the end of a line of C++ code, you may have committed which type of error? a) logic b) runtime el syntax d) warning €) execution 37.C+* statement to increase the value of variable N by 10: a int +10, b)intN=N "40; C)intN = 10; 4) int N= N-10; 38.1F A and B are boolean variables, then the expression (! || (18) is equivalent to which of the following conditions: a) (VA 118) “DL (A 6&6 B)) ©) (A) 8& (18) 4) (1A) [1 (18) 39.What will be the output of following case: cout << 3 * 445 << endl; a)27 be “047 12 40.How many times does the following loop execute: for (i= a) 100 times b) 99 times 1101 times ) 90 times 41.The following C++ code segment = x) is equivalent to: abit byit ly <=») ify) a) if (<= y) 42.What is the output of the following program segment? intx .¥=0% if (> 088 y<0){ x=y= 23; 43.What using statement do you always put at the top of your programs (to get standard naming conventions)? a) using name std; blusing namespace std: c) using std; 4) using namespace; 44.Which of following called logical OR operator: a) && 45.C++ statement that prints true if x and y have the same sign (-/+): a) if (:>=0 && yo=0) coute<"true"; D) if (x<=0 8& y<=0) cout<<"true"; aio || y>=0) coute<"true’ cA) if*y>0) couts<"true"; 46.1n switch case, what keyword covers unhandled possibilities? a) contingency *b) default other d) all 47.Which is NOT a loop structure? a) for b) while ‘] repeat until 4) do-while 48.Evaluate #(1 && 1(0 || 1)) 7a) True b) False ©) Unevaluatable ) Null 49.What is the output of the following program segment? oO: dol cout << i << "\n") i) while (i< 3); a)0123 byt 2 3 q12 ‘a0 '50.What punctuation ends most lines of C++ code? a). b, a)" 51LWhich of the following is the correct operator to compare two variables? ali b= 4d) equal '52.What is the output of the following program segment? int day switch (day) ( case 6: cout << "Today is Saturday"; break; case 7: cout << "Today is Sunday"; break; default: cout << "Looking forward to the Weekend” } a) Saturday b) Sunday ) Today is Saturday d) Today is Sunday ‘e) Looking forward to the Weekend £) No output '53.Which of the following is NOT a correct variable type? a) float Olly>)" '56.Header file Itis used to: al define the cout, and cin objects, which correspond to standard output stream, and standard input stream b) declare services useful for performing formatted 1/0, such as setprecisi setw ) declare services for user-controlled file processing 4) None of above 57.Whal the output of the following program segment? int myNum = 10; int yourNum = 30; if (yourNum % myNum == 3){ yourNum = 3; ‘myNum_ else if (yourNum % myNum yourNum = 2; smyNum = 25} else { yourNum = 4; myNum = 3; } cout <« myNum << " sala b) 30 << yourNum << endl; } a3 au '58.When C++ if-else statement tests the condition, it executes if: a) condition is true b) condition is false ‘block if condition is true otherwise else block is executed 4) block if condition is false otherwise else block is executed 59.C#+ statement that prints true if xis an odd number and positive: a) if (2 !=0 || x>0) coute<"true"; “b)if x % 2 10 &&x> 0) cout<<"true"; ifs 68 x< 0} cout<<"true"; 4d) if ¢%2==0 || x>0) couts<"true"s the output of the following program segment? couts< "The first three multiples of 3 are:"<

You might also like