Computer Programming Questions

April 17, 2018 | Author: Aravind Kumaran | Category: Data Type, Subroutine, Control Flow, Variable (Computer Science), Time Complexity
Share Embed Donate


Short Description

CP...

Description

1. Which of the following statements is/are true about optical fibres? 1. Optical fibre transports signal on the basis of total internal reflection principle. 2. Refractive index of core should be less than that of cladding. 3. ver! beam which stri"es the interface of core and cladding is reflected bac". #$$ ### #$# $$$

2. %assage &i'a! wants to print the following pattern on the screen( 1 12 123 )e writes the following program( *nteger * + 1 // statement 1 While,i -+3   *nt ' // statement 2 While , ' -+ i  // statement 3  print ' print blan" space

'+ '01 // statement   print endofline // ta"es the cursor to the next line i+i01  4uestion( a. 5tatement 1 b. 5tatement 2 675 c. 5tatement 3 d. 5tatement  e. %rogram does not have error 3. %assage( 6bhinav wants to find the largest number in a given list of 28 numbers. which of the following options is an efficient approach to do this? 1 use bubble sort to sort the list in descending order and then print the first number of the series. 2 use selection sort to sort the list in descending order and then print the first number of the series 3 implement one iteration of selection sort for descending order and print the first number in the series.675  none of these

passage( what is implied b! the argument of a function? 9uestion 1. the variables passed to it when it is called675 2. the value it returns on execution 3. the execution code inside it . its return t!pe

passage( there are two loops which are nested. this implies which one of the following? 9uestion 1.

two loops: one after the other

2.

two loops: one inside the otherans

3.

one loop with two different iteration counts

.

two loops with the same iteration count

%assage( ;ar! is ma"ing a database of animals in a d0b return c  function calculate,  integer a+G:b+28:c integer d+18 c+modif!,a:b= c+c0d print c 

4uestion=

Consider the code given in the %assageP. 6ssume that a@ and b@ are passed b! the value. What wil be the output of the program be when the function calculate, is executed? • • • •

I8 8 J675 32 T2

4uestion= #risha wants to use a data structure in which the cost of deleting: adding and traversing its elements is the same and constant. Which of the following data structures should she use? • • • •

A #ree 6&F #ree 4ueue 5tac"

4uestion= #he program to print the larger of the two numbers entered b! the user is given below. Which of the following should be substituted in place of ??@ in 5tatement 1 of the code to get the desired output? int number1: number2 input number1: number2 if ,?? //5tatement1 print number1 else print number2

endif Option= number1Qnumber2 J675 number2Qnumber1 number2 e9uals number1 number1-+number2 %assage( integer i:":':n +G for i+n to 1 decreament 1  for '+n to i01 decreament1  print blan"s pace  for "+1 to ,,2>i1 increament 1  print@>@  print endofline //ta"es the cursor to the next line  4uestion= What will be the output when the given code is executed? a>>>>>

>>>> >>> >> > b>>>>> >>>> >>> >> >675 C>>>>> >>>> >>>>> >>>> >>>>> d

> >> >>> >>>> >>>>>

e>>>>>>>>> >>>>>>> >>>>> >>>

>

4uestion= Consider the given conditions in regards to binar! search performed on an named ;!6rra! 1. 2. 3.

Aeg Qend Aeg-+end ;!6rra!midS+ itemXtoXbeXsearched Which of the given conditions forms the termination condition of an iterative binar! search when the variables Aeg:nd and mid have their usual meanings? Onl! 1 J675 Onl! 2 Onl! 3

• • •

Aoth 2 and 3 6ll 1:2 and 3

• •

4uestion= 6ssume the following procedure ,high:low. Operators in the same row have the same procedure. ,. >/ 0 67D OR #he precedence is from the left to right in the expression for the operators with the e9ual precedence: Which of the following statements is #RE about the output of the code statements given below?

integer a+8: b+3G: c+28: d+18 print a>b /cd print a>b/,cd • • • •

the outputs differ b! I8 675 the outputs are the same the outputs differ b! G8 the outputs differ b! 1H8

$rom pg num(3T to H %assage function modif!,!:,abN< %an"a' writes the following code statements,code 6( %rint,ab0c/,ab>,ab ;!thili writes the following code statements,code A( D+,ab %rint d0c/d0d>d *f the time ta"en to load a value in a variable: for addition:multiplication or division between two operands is same: which of the following is true? • • • •

Code 6 uses lesser memor! and is slower than code A ,ans Code 6 uses lesser memor! and is faster than code A Code 6 uses more memor! and is faster than code A Code 6 uses more memor! and is slower than code A

$or solving a problem: which of these is the first step in developing a wor"ing program for it? • • • •

Writing the program in the programming language . Writing a stepb!step algorithm to solve the problem.,ans Compiling the libraries re9uired. Code debugging.

Which of the following data t!pes does not belong to the categor! of abstract data t!pes? • • •

)ashtable 5et Ob'ect ,ans

5oting is not possible b! using which of the following methods?

• • • •

*nsertion 5election xchange Deletion ,ans

#he algorithm design techni9ue used in the 9uic" sort algorithm is • • • •

D!namic programming Aac" trac"ing Divide and con9uer,ans Mreed! search

6ssume the following precedence ,high to low. Operators in the same row have the same precedence. ,. >/ 0 67D OR #he precedence is from left to right in the expression for the operators with e9ual precedence. Which of the following statements is #RE about the output of the code statements given below? *nteger a+8:b+3G:c+28:d+18 %rint a>b/cd %rint a>b/,cd • • • •

#he output differ b! I8.,ans #he output are the same. #he ouputs differ b! G8. #he output differ b! 1H8.

6 programmer mista"enl! writes gor@ instead of the "e!word@for@ used in loops: while writing a program in C00.What iwill this result in? • • • •

#he code would not compile.,ans #he code would give an error while execution. #he code ma! wor" for some inputs and not for the others. #he code would not create an! problem.

6 programmer writes a sorting algorithm that ta"es different amount of time to sort two different lists of e9ual sib/cd printa>b/,cd assume the following precendence,high to low operators in the same row have the same precedences( , >/ 0 67D OR $or operators with e9ual precedence the precedence is fromleft to right in expression. • • • •

Differ b! I8,ans 5ame Differ b! G8 Differ b! 1H8

5orting is not possible b! using which of the following methods? • • • •

*nsertion 5election xchange Deletion,ans

Which of the following statements is true about the logical view of a database? •







*t is also "nown as ph!sical view and there can be one or more logical views of a database *t is also "nown as ph!sical view and ter is onl! one logical view of a database *t is also "nown as conceptual view and there can be one or more logical views of a database *t is also "nown as conceptual view and there is onl! one logical view of a database

5ru'an writes a sorting algorithm ta"es different amount of time to sort two different lists of e9ual si
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF