+ All Categories
Home > Technology > Test for computer languages

Test for computer languages

Date post: 13-Jan-2015
Category:
Upload: manish-katara
View: 302 times
Download: 2 times
Share this document with a friend
Description:
 
4
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 B. Dennis Ritchie C. 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 c)7 d) none KNOW YOUR CODING SKILLS Q.5 What will be the output? main() {
Transcript

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 B. Dennis Ritchie

C. 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 c)7 d) none KNOW YOUR CODING SKILLS

Q.5 What will be the output?

main()

{

int a=9;

if(a=5){

printf("Bye");

}

printf("Welcome");}

A. error B. compile failed

C. welcome D. Bye

Q.6 Which one is the correct order of evaluation for the below expression?

z = x + y * z / 4 % 2 - 1

A. * / % + - = B. = * / % + -

C. / * % - + = 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 B. Ken Thompson

C. Bjarne Stroustrup D. Dennis Ritchie KNOW YOUR CODING SKILLS

Q.11. Find out the error in following block of code.

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 B. The DO statement C. The FOR statement D. All of above E. None 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 ( ; ; )… B. IF (=) BREAK; C. WHILE ()… D. All of above E None of above

Q.15 The comma operator (,) is primarily used in conjunction with

A.FOR statement B.IF-ELSE statement C.DO-While statement D. All of above 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.

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 C.Underscores D Spaces

Q.19 In an assignment statement 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


Recommended