Monday, July 4, 2011

C Programming

C Programming
LIST OF ATTEMPTED QUESTIONS AND ANSWERS


Select The Blank
 Question When the values are passed to a function as an argument, it is called as ________
Correct Answer call by value
Your Answer call by value


Multiple Choice Multiple Answer
 Question Which of the following are not control instructions in C?
Correct Answer Input/ Output, Arithmetic
Your Answer Input/ Output, Arithmetic


True/False
 Question In TSD based client server architecture, the user interface is loosely coupled with the data.
Correct Answer False
Your Answer False


Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ int a = 1;float f=1; printf("%d", a * f); printf("%f", a * f); printf(%f",a + f * 100);}
Correct Answer 0 , 1.000000 , 101.000000
Your Answer 0 , 1.000000 , 101.000000


True/False
 Question If the value of a formal argument is changed in the called funciton, the corresponding changes take place in the calling function.
Correct Answer False
Your Answer False


True/False
 Question Functions are written to avoid rewriting the same section of code which requires oftenly.
Correct Answer True
Your Answer True


Select The Blank
 Question When the addresses of variables are passed to a function as an argument, it is called as ________
Correct Answer call by reference
Your Answer call by reference


Select The Blank
 Question There are basically ________ types of instrucitons in C.
Correct Answer 4
Your Answer 2


Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ char c='d';float f=1; printf("%c", c); printf("%f", c * f);}
Correct Answer d , 100.000000
Your Answer d , 100.000000


Multiple Choice Single Answer
 Question How many times 'return' statement can be written?
Correct Answer any
Your Answer once


Select The Blank
 Question ________ function finds first occurrence of a given character in a string.
Correct Answer strchr
Your Answer strchr


Match The Following
 Question Correct Answer Your Answer
Test Model Stipulates test strategy, test plans, test specifications, test results and test recovary reports. Stipulates test strategy, test plans, test specifications, test results and test recovary reports.
Analysis Object Model Presents information how object model will be executed. Presents information how object model will be executed.
Use case Model Defines actors inside and outside of use case and their behaviour. Defines actors inside and outside of use case and their behaviour.
Implementation Model Converts design object model to implementation model based on reusable component technology. Implements use case data


Select The Blank
 Question The address of the zeroth element is also called as ________
Correct Answer Base address
Your Answer Base address


Select The Blank
 Question ________ is a person or device that uses the system.
Correct Answer User
Your Answer Entity


Multiple Choice Multiple Answer
 Question What will be the output? main( ) { int a[10],i=0; for( ;i<=10;i++) a[i]=i+1; printf("%d",i); printf("%d",a[i-=2]); }
Correct Answer 11 , 10
Your Answer 11 , garbage value


Select The Blank
 Question ________ could be the alternate for if when it is related to integer / character constant expression only.
Correct Answer switch
Your Answer switch


Match The Following
 Question Correct Answer Your Answer
%c Format specification for a character Format specification for a character
gets() To accept a string from keyboard To accept a string from keyboard
puts() To display a string on the screen Sets first n characters of a string to a given character.
%s Format specification for a string Format specification for a string


Select The Blank
 Question Array elements should be accessed using ________ if the elements are to be accessed in a fixed order.
Correct Answer Pointers
Your Answer Subscripts


Multiple Choice Single Answer
 Question When array elements are passed to a function with their values, it is called as:-
Correct Answer Call by value
Your Answer Call by value


True/False
 Question switch requires an integer expression.
Correct Answer True
Your Answer True


Multiple Choice Multiple Answer
 Question Opening a file establishes a link between :-
Correct Answer the program , the operating system
Your Answer the program , the operating system


Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ int i = 1; char c='A'; printf("%d",i * c); printf("%f",i * (c+2));}
Correct Answer floating point error , 65
Your Answer 65 , 67.000000


Multiple Choice Single Answer
 Question Use case defines and describes what happens in the system in logical order. This is termed as :-
Correct Answer System behaviour
Your Answer System analysis


Multiple Choice Single Answer
 Question In declaration char name[20]; it can hold
Correct Answer 20 characters
Your Answer 20 characters


True/False
 Question One structure can be nested within another structure.
Correct Answer True
Your Answer True


Multiple Choice Single Answer
 Question Any C function by default returns which value?
Correct Answer int
Your Answer int


Multiple Choice Single Answer
 Question A function definition is enclosed within :-
Correct Answer { }
Your Answer ( )


True/False
 Question Standard I/O functions are nothing but stream I/O functions.
Correct Answer True
Your Answer True


Multiple Choice Multiple Answer
 Question Which of the following are basic data types in C?
Correct Answer int , float , char
Your Answer int , float , char


Multiple Choice Multiple Answer
 Question Point out the errors if any struct student{ int roll; int course, char duration; } main(){ struct student s1; int *p; p=&s; p.roll=101; }
Correct Answer Incorrect p.roll=101 , no error but warning for suspicious pointer conversion
Your Answer Incorrect p.roll=101 , address of structure cannot be assigned to an integer
pointer  Question Default statement is optional in switch.
Correct Answer True
Your Answer False


True/False
 Question Formal and Actual arguments cannot be same.
Correct Answer False
Your Answer False


Select The Blank
 Question ________ should be avoided in programming.
Correct Answer goto
Your Answer goto


Multiple Choice Single Answer
 Question Which is the ASCII value of End of file?
Correct Answer 26
Your Answer 26


Multiple Choice Single Answer
 Question if an integer a = 2 and float b =6, the expression a + b evaluates to
Correct Answer 8.000000
Your Answer 8.000000


Select The Blank
 Question ________ is escape sequence for new line.
Correct Answer \n
Your Answer \n


Multiple Choice Single Answer
 Question Which of the following is a unformatted console I/O function to display a string?
Correct Answer puts
Your Answer putchar


Multiple Choice Single Answer
 Question The language used for modeling and documenting system is :-
Correct Answer UML
Your Answer UML


Multiple Choice Multiple Answer
 Question Which of the following statements are valid for C language?
Correct Answer one man language , developed in 1972
Your Answer developed in 1972 , Only Low level language


Multiple Choice Single Answer
 Question The simple logic for system specifications is provided by a languages named :-
Correct Answer OCL [ Object Constraint Language ]
Your Answer OOPL [
Object oriented Programming Language ]


True/False
 Question Logical operators cannot be used with 'do' loop.
Correct Answer False
Your Answer False


Multiple Choice Single Answer
 Question An array is a collection of :-
Correct Answer The same data type placed next to each other in memory
Your Answer The same data type placed next to each other in memory


Multiple Choice Multiple Answer
 Question Which of the following operators have 2nd priority in operations?
Correct Answer + , -
Your Answer + , -


Select The Blank
 Question After goto, ________ has to be mentioned to pass the control.
Correct Answer label name
Your Answer label name


True/False
 Question The sequence diagram shows flow of behaviour and collaboration of objects.
Correct Answer False
Your Answer True


Multiple Choice Single Answer
 Question Which of the following is valid statement to declare a string?
Correct Answer char name[20];
Your Answer char name[20];


Multiple Choice Multiple Answer
 Question What will be the output? main(){ int a=25, *b, **c; b=&a;c=&b; printf("%d",*c); printf("%u %u",b,c}
Correct Answer garbage value , address of a , address of b
Your Answer address of a , address of b



True/False

Wednesday, July 16, 2008

C Programming - 5

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

Multiple Choice Single Answer
 Question In logical AND :-
Correct Answer Both the conditions have to be TRUE
Your Answer Both the conditions have to be TRUE

Multiple Choice Multiple Answer
 Question Which of the following fuctions require at least two strings as a parameter?
Correct Answer strcpy , strcat , strcmp
Your Answer strcpy , strcat , strcmp

Select The Blank
 Question ________ function is identical to strcmpi()
Correct Answer stricmp
Your Answer strcmp

Multiple Choice Single Answer
 Question C can be used on
Correct Answer All the above
Your Answer All the above

Multiple Choice Multiple Answer
 Question Which of the following combinations in arithmetic operation give real result?
Correct Answer real and real , integer and real
Your Answer real and real , integer and real

Multiple Choice Multiple Answer
 Question When an entire array is passed to a function, it could be passed by :-
Correct Answer Zeroth element of an array , Only name of the array
Your Answer Only name of the array , Pointer of the array

True/False
 Question A function can return only one value at a time.
Correct Answer True
Your Answer True

True/False
 Question argv is an array of pointers.
Correct Answer True
Your Answer True

True/False
 Question Comments cannot be nested.
Correct Answer True
Your Answer True

Multiple Choice Single Answer
 Question The simple logic for system specifications is provided by a languages named :-
Correct Answer OCL [ Object Constraint Language ]
Your Answer OOPL [ Object
oriented Programming Language ]

Multiple Choice Single Answer
 Question Which of the following is not a character constant
Correct Answer 'Thank You'
Your Answer 'Thank You'

Multiple Choice Single Answer
 Question The method for industrial development of software based on use-case-driven design is
Correct Answer OOSE [ Object Oriented
Software Engineering ]
Your Answer OOD [ Object Oriented Design ]

Select The Blank
 Question ________ operator gives the size of the variable in bytes.
Correct Answer sizeof()
Your Answer sizeof()

Select The Blank
 Question Array elements should be accessed using ________ if the elements are to be accessed in a fixed order.
Correct Answer Pointers
Your Answer Pointers

Multiple Choice Single Answer
 Question How many types are there of arguments?
Correct Answer two
Your Answer two

Multiple Choice Single Answer
 Question UML uses :
Correct Answer OCL [ object Constraint Language ]
Your Answer FGL [ Forth Generation Language ]

True/False
 Question When array elements are passed to a function with call by reference, function has pointer arguments.
Correct Answer True
Your Answer True

Multiple Choice Single Answer
 Question When the method is chosen and performed on the data, the object status changes. The static object assumes :-
Correct Answer Dynamic state
Your Answer Dynamic state

True/False
 Question A constant is a quantity that doesn't change
Correct Answer True
Your Answer True

Multiple Choice Single Answer
 Question In sequence diagram, the horizontal arrowhead line shows
Correct Answer Message 'from- to'
Your Answer Sequence of events

Select The Blank
 Question Operation between ________ and a real always yields a Real result
Correct Answer a Real
Your Answer an integer

Multiple Choice Multiple Answer
 Question Opening a file establishes a link between :-
Correct Answer the program , the operating system
Your Answer the operating system , buffer , the program

Multiple Choice Single Answer
 Question The collaboration diagram shows both :-
Correct Answer Collaboration and sequence
Your Answer Collaboration and sequence

Multiple Choice Single Answer
 Question In exponential form range of real constant the part that appears before 'e' is called
Correct Answer mantissa
Your Answer exponent and mantissa

True/False
 Question The interaction diagrams are not good enough if behaviour of object is conditional and gets into a loop.
Correct Answer True
Your Answer False

True/False
 Question The control instructions determine the 'flow of control' in a program.
Correct Answer True
Your Answer True

Multiple Choice Multiple Answer
 Question What will be the output? main ( ) { int suite = 3 ; switch (suite) { case 1:printf( "\nDiamonds" ) ; case 2:printf( "\nSpade" ) ; default :printf( "\nHeart" ) ; }printf ("\nI thought one wears a suite") ; }
Correct Answer Heart , I thought one wears a suite
Your Answer Heart , I thought one wears a suite

Select The Blank
 Question After the case, ________ _expression is not allowed.
Correct Answer float
Your Answer arithmetic

Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ int a=10,b=20,c; printf("%d", a + b); printf("%d", c+a); c=a;}
Correct Answer 30 , garbage value
Your Answer 30 , garbage value

Multiple Choice Single Answer
 Question A function which is called is refered as :-
Correct Answer called function
Your Answer called function

Multiple Choice Single Answer
 Question Which of the following is a unformatted console I/O function to get a string input?
Correct Answer gets
Your Answer gets

Select The Blank
 Question ________ is a output statement in C
Correct Answer printf
Your Answer printf

Select The Blank
 Question ________ function compares first n characters of two strings without regard to case.
Correct Answer strnicmp
Your Answer strcmp

Multiple Choice Single Answer
 Question Though the names of formal and actual arguments are similar, they are treated as different variables because they are :-
Correct Answer in different functions
Your Answer in different functions

Match The Following
 Question Correct Answer Your Answer

\r carriage return carriage return

\b backspace bakslash

\f form feed form feed

\t tab tab


True/False
 Question Functions are written to avoid rewriting the same section of code which requires oftenly.
Correct Answer True
Your Answer True

Select The Blank
 Question ________ is a person or device that uses the system.
Correct Answer User
Your Answer User

Select The Blank
 Question ________ function is used to convert a string to upper case
Correct Answer strupr
Your Answer strupr

Select The Blank
 Question Any C statement ends with ________.
Correct Answer ;
Your Answer ;

Multiple Choice Multiple Answer
 Question When an array has both rows and columns it is called as:-
Correct Answer 2-D array , Matrix
Your Answer 2-D array , Matrix

Match The Following
 Question Correct Answer Your Answer

addition(int,int); return an integer value which passes 2 integer arguments Both arguments of float type which returns real value.

addition(); an integer function with no arguments an integer function with no arguments

float addition(int, float); a float function having integer and float type arguments a float function having integer and float type arguments

char addition(char,char); a char function having 2 arguments of char type a char function having 2 arguments of char type


True/False
 Question In collaboration diagrams, the connection between objects is shown.
Correct Answer True
Your Answer True

Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ char c='d'; printf("%d", c); printf("%d", c * (7/22));}
Correct Answer 100 , 0
Your Answer 100 , 31

Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ char c='d';float f=1; printf("%c", c); printf("%f", c * f);}
Correct Answer d , 100.000000
Your Answer d , 100.000000

True/False
 Question Logical operators cannot be used with 'do' loop.
Correct Answer False
Your Answer False

Multiple Choice Single Answer
 Question In which type, the values are passed to a function?
Correct Answer call by value
Your Answer call by value

Select The Blank
 Question ________ should be avoided in programming.
Correct Answer goto
Your Answer goto

C Programming - 4

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

Select The Blank
 Question ________ operator is used to refer to the structure element, when structure pointer is declared
Correct Answer ->
Your Answer ->

Select The Blank
 Question Usually structure type declaration appears at the ________ of the source code file, before any variable/functions are defined.
Correct Answer top
Your Answer top

Select The Blank
 Question The address of the zeroth element can also be passed by just passing the ________ of the array.
Correct Answer Name
Your Answer Name

Multiple Choice Single Answer
 Question Which of the following is a unformatted console I/O function to display a string?
Correct Answer puts
Your Answer puts

True/False
 Question Primary and Secondary are the two types of constants in C.
Correct Answer True
Your Answer False

Multiple Choice Multiple Answer
 Question What will be the output? main(){ int i; void show(int); for(i=65;i<68;i++) show(i);} void show(int i){ printf("\n%c",i);}
Correct Answer A , B , C
Your Answer A , B , C

Select The Blank
 Question Arithmatic operations can be performed on characters where their ________ value is used.
Correct Answer ASCII
Your Answer ASCII

Select The Blank
 Question The keyword ________ is followed by an interger or a character constant.
Correct Answer case
Your Answer case

Match The Following
 Question Correct Answer Your Answer

% Modulus operator Modulus operator

<, >, <=, >= etc. Relational operator Relational operator

= = Comparison for equal value Comparison for equal value

Logical opertor - OR Logical opertor - OR


Multiple Choice Single Answer
 Question The collaboration diagram shows interaction between objects and sequence of activities denoted by :-
Correct Answer Members
Your Answer Methods

Select The Blank
 Question The ________ diagram is used to understand or model the flow of system through classes or objects.
Correct Answer Activity
Your Answer Venn

Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ int i = 1; char c='A'; printf("%d",i * c); printf("%d",i * (c+2));}
Correct Answer 65 , 67
Your Answer 65 , 67

True/False
 Question An Array is a Primary Constant
Correct Answer False
Your Answer True

Multiple Choice Multiple Answer
 Question Which operators are used to access the individual structure element.
Correct Answer . , ->
Your Answer . , ->

Multiple Choice Single Answer
 Question The sequence diagram follows the following sequence :-
Correct Answer Use-case-transaction sequence
Your Answer Use-case-transaction sequence

Multiple Choice Single Answer
 Question Which type of I/O functions are used to perform I/O operations on various ports?
Correct Answer Port
Your Answer Port

Multiple Choice Multiple Answer
 Question What will be the output? main( ) { int a[10]={65,66,67},i=0; printf("%c",a[i]++); printf("%c",a[i]); }
Correct Answer A , B
Your Answer A , B

True/False
 Question Initialisation of the conditional variable is necessary for while loop.
Correct Answer True
Your Answer True

Multiple Choice Single Answer
 Question What is the another name of 'value at address' operator?
Correct Answer indirection
Your Answer indirection

True/False
 Question If break is not used in cases, compiler gives an error.
Correct Answer False
Your Answer False

Multiple Choice Single Answer
 Question If 'return' statement is written without any value, which of the following is used for empty value?
Correct Answer nothing, only 'return;' has to be written
Your Answer nothing, only 'return;' has to be written

Multiple Choice Single Answer
 Question C language has been developed at
Correct Answer AT & T Bell Labs, USA
Your Answer AT & T Bell Labs, USA

Multiple Choice Multiple Answer
 Question Which of the following modes are used to read from a file?
Correct Answer r , r+
Your Answer r , r+ , w

Select The Blank
 Question Booch emphasises development of mechanisms with ________ model.
Correct Answer Data
Your Answer Data

True/False
 Question The set of statements belongining to a function are enclosed within a pair of braces.
Correct Answer True
Your Answer True

Select The Blank
 Question ________ is a relation operator used to compare for equal values
Correct Answer ==
Your Answer ==

Multiple Choice Single Answer
 Question Which of the following statements is decision making instruction?
Correct Answer if
Your Answer if

Select The Blank
 Question A structure can be used to ________ a floppy.
Correct Answer format
Your Answer read

Multiple Choice Single Answer
 Question Two statements are written within if block without any braces, if condition is true it will :-
Correct Answer execute the first statement in the block and the 2nd will get executed irrespictive of the condition is true or false
Your Answer execute the first statement in the block and the 2nd will get executed irrespictive of the condition is true or false

True/False
 Question In an array of structures all elements of the array are stored in adjacent memory locations.
Correct Answer True
Your Answer True

True/False
 Question puts() can display only one string at a time.
Correct Answer True
Your Answer False

Multiple Choice Single Answer
 Question The break statement is used to exit from:-
Correct Answer A for loop
Your Answer A for loop

True/False
 Question Middle Level Language is the language which has both good programming efficiency and a good machine efficiency
Correct Answer True
Your Answer True

Multiple Choice Single Answer
 Question Which function is used to open a file?
Correct Answer fopen
Your Answer fopen

Match The Following
 Question Correct Answer Your Answer

%c Format specification for a character Format specification for a character

gets() To accept a string from keyboard To accept a string from keyboard

puts() To display a string on the screen To display a string on the screen

%s Format specification for a string Format specification for a string


Multiple Choice Single Answer
 Question When you pass an array as an argument to a function, what actually gets passed?
Correct Answer Address of the first element of the array [base address]
Your Answer Address of the first element of the array [base address]

Multiple Choice Multiple Answer
 Question What will be the output? main(){ char name[10]="String"; int j=0; while(name[j]!='\0') { printf("%c",name[j]); j+=3; } printf("%c",name[--j]);}
Correct Answer S , i , g
Your Answer g

Multiple Choice Single Answer
 Question An array 'num' of integer type for 3 rows and 5 columns should be declared as
Correct Answer int num[3][5]
Your Answer int num[3][5]

Multiple Choice Single Answer
 Question An _expression contains relational operators, assignement operators, and arithmatic operators. In the absence of parentheses, they will be evaluated in which of the following order?
Correct Answer Arithmetic, relational, assignment
Your Answer Arithmetic, relational, assignment

Select The Blank
 Question ________ function appends first n characters of a string at the end of another
Correct Answer strncat
Your Answer strncat

Multiple Choice Multiple Answer
 Question What will be the output? main(){ char name[10]="String",n[10]=""; int k; strncat(n,name,3); for(k=0;n[k]!='\0';k++) printf("\n%d",n[k]);}
Correct Answer 83 , 116 , 114
Your Answer 115

Multiple Choice Multiple Answer
 Question Which of the following modes are used to write to a file?
Correct Answer w , w+ , a
Your Answer w , w+ , a

Select The Blank
 Question There are as many as ________ odd operators in C which can affect the evaluation of an expession in subtle and unexpected ways
Correct Answer 45
Your Answer 10

Multiple Choice Multiple Answer
 Question What will be the output of the following main(){ char c='ab'; printf("%c", c); printf("%d",c);}
Correct Answer a , 97
Your Answer a , 97

Multiple Choice Multiple Answer
 Question Which of the following fuctions require a single string as a parameter?
Correct Answer strlen , strlwr , strupr
Your Answer strlen , strlwr , strupr

True/False
 Question Once file is open it is always refered by its FILE pointer
Correct Answer True
Your Answer True

True/False
 Question While passing an array elements to a function by call by value we pass values of array elements to the function
Correct Answer True
Your Answer True

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.