Test for computer languages


Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Test for computer languages

  1. 1. KNOW YOUR CODING SKILLS DEMO TEST Name : ………………………………….. Class: ………….. Date : ……………….. Total Questions: 20 Max. Time : 30 Minutes Note: 1 Mark for right answer and -0.25 mark for Wrong Answer. Q.1 Which of the following special symbol allowed in a variable name? A. * (asterisk) B. | (pipeline) C. - (hyphen) D. _ (underscore) Q.2 Point Out The error in the following program. #include<stdio.h> int main() { display(); return 0; } void display() { printf("Know Your Coding Skills"); } A. No error B. display() doesn't get invoked. C. display() is called before it is defined D. None of these Q.3 What is the name of the man who is invented to c? A. Charles Babbage C. Dennis & Ritchie B. Dennis Ritchie D. None Q.4 what will be the output? main() { int n=125,sum=0,res ; while(n>0) { res=n%10; sum +=res; n/=10; } printf("Sum is %d",sum); } a) error b)8 Q.5 What will be the output? main() { c)7 d) none KNOW YOUR CODING SKILLS
  2. 2. int a=9; if(a=5){ printf("Bye"); } printf("Welcome");} A. error C. welcome B. compile failed D. Bye Q.6 Which one is the correct order of evaluation for the below expression? z=x+y*z/4%2-1 A. * / % + - = C. / * % - + = B. = * / % + D. * % / - + = Q.7 What will be the output of printf("n"); A. n B. n C. error D. none Q.8 In C , the execution of the program starts from ? A. the firstly defined function B. main( ) function C . the lastly defined function D. none of these Q.9 How many time the following function be called main( ) { int j; j=10; fun(j); } fun(int j) { if( j !=5) fun( j-1 ); } A.10 times B.5 times C.6 times D.Infinite loop Q.10. C++ was invented by A. Donald Drum C. Bjarne Stroustrup B. Ken Thompson D. Dennis Ritchie KNOW YOUR CODING SKILLS Q.11. Find out the error in following block of code.
  3. 3. If (x = 100) Cout << “x is 100”; A. 100 should be enclosed in quotations B. There is no semicolon at the end of first line C. Equals to operator mistake D. Variable x should not be inside quotation Q12. C provides loop constructs for performing loop operations. They are A. The WHILE statement C. The FOR statement B. The DO statement E. None of above D. All of above Q.13.What will this program display? #include <stdio.h> main() { float f; f=10/3; printf ("%d",f); } A. 3.3 B. 3.0 C. 3 D. 0 Q.14. The traditional way to create an infinite loop in C is A. FOR ( ; ; )… D. All of above B. IF (=) BREAK; C. WHILE ()… E None of above Q.15 The comma operator (,) is primarily used in conjunction with A.FOR statement D. All of above B.IF-ELSE statement C.DO-While statement E. None of above Q.16. Overloaded functions are A. Very long functions that can hardly run B.. One function containing another one or more functions inside it. KNOW YOUR CODING SKILLS C. Two or more functions with the same name but different number of parameters or type.
  4. 4. D. None of above Q.17 What is the output of code given below? #include<stdio.h> main() { const int i =4; float j; j = ++i; printf(“ %d",i++); } A.5 B. 6 C. 4 D. Compiler error Q.18 Which of the following can not be used as Identifier ? A.Letters B.Digits Q.19 In an assignment statement C.Underscores D Spaces a=b; Which of the following statement is true? A. The variable a and the variable b are equal. B. The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a C. The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a D. The value of variable a is assigned to variable b and the value of variable b is assigned to variable a. Q.20 Evaluate ! (1&&!(0||1)). A. True B. False C. Unevaluatable D. 0