Placement Written test paper for MNC  Computer questions and answers part1
Ques 1 : Choose the correct answer  
There is a new datatype which can take as values natural numbers between (and including) 0 and 25. How many minimum bits are required to store this datatype.  
Option 1 : 4  Option 2 : 5  Option 3 : 1  Option 4 : 3  


Ques 2 : Choose the correct answer  
A data type is stored as an 6 bit signed integer. Which of the following cannot be represented by this data type?  
Option 1 : 12  Option 2 : 0  Option 3 : 32  Option 4 : 18  


Ques 3 : Choose the correct answer  
A language has 28 different letters in total. Each word in the language is composed of maximum 7 letters. You want to create a datatype to store a word of this language. You decide to store the word as an array of letters. How many bits will you assign to the datatype to be able to store all kinds of words of the language.  
Option 1 : 7  Option 2 : 35  Option 3 : 28  Option 4 : 196  


Ques 4 : Choose the correct answer  
A 10bit unsigned integer has the following range:  
Option 1 : 0 to 1000  Option 2 : 0 to 1024  Option 3 : 1 to 1025  Option 4 : 0 to 1023  


Ques 5 : Choose the correct answer  
Rajni wants to create a datatype for the number of books in her book case. Her shelf can accommodate a maximum of 75 books. She allocates 7 bits to the datatype. Later another shelf is added to her bookcase. She realizes that she can still use the same datatype for storing the number of books in her bookcase. What is the maximum possible capacity of her new added shelf?  
Option 1 : 52  Option 2 : 127  Option 3 : 53  Option 4 : 75  


Ques 6 : Choose the correct answer  
A new language has 15 possible letters, 8 different kinds of punctuation marks and a blank character. Rahul wants to create two data types, first one which could store the letters of the language and a second one which could store any character in the language. The number of bits required to store these two datatypes will respectively be:  
Option 1 : 3 and 4  Option 2 : 4 and 3  Option 3 : 4 and 5  Option 4 : 3 and 5  


Ques 7 : Choose the correct answer  
Parul takes as input two numbers: a and b. a and b can take integer values between 0 and 255. She stores a, b and c as 1byte data type. She writes the following code statement to process a and b and put the result in c.
c = a + 2*b To her surprise her program gives the right output with some input values of a and b, while gives an erroneous answer for others. For which of the following inputs will it give a wrong answer? 

Option 1 : a = 10 b = 200  Option 2 : a = 200 b = 10  Option 3 : a = 50 b = 100  Option 4 : a = 100 b = 50  


Ques 8 : Choose the correct answer  
Prashant takes as input 2 integer numbers, a and b, whose value can be between 0 and 127. He stores them as 7 bit numbers. He writes the following code to process these numbers to produce a third number c. c = a – b In how many minimum bits should Prashant store c? 

Option 1 : 6 bits  Option 2 : 7 bits  Option 3 : 8 bits  Option 4 : 9 bits  


Ques 9 : Choose the correct answer  
Ankita takes as input 2 integer numbers, a and b, whose value can be between 0 and 31. He stores them as 5 bit numbers. He writes the following code to process these numbers to produce a third number c.
c = 2*(a – b) In how many minimum bits should Ankita store c? 

Option 1 : 6 bits  Option 2 : 7 bits  Option 3 : 8 bits  Option 4 : 9 bits  


Ques 10 : Choose the correct answer  
A character in new programming language is stored in 2 bytes. A string is represented as an array of characters. A word is stored as a string. Each byte in the memory has an address. The word “Mahatma Gandhi” is stored in the memory with starting address 456. The letter ‘d’ will be at which memory address?  
Option 1 : 468  Option 2 : 480  Option 3 : 478  Option 4 : 467  


Ques 11 : Choose the correct answer  
Stuti is making a questionnaire of Truefalse questions. She wants to define a datatype which stores the response of the candidate for the question. What is the mostsuited data type for this purpose?  
Option 1 : integer  Option 2 : boolean  Option 3 : float  Option 4 : character  


Ques 12 : Choose the correct answer: A pseudocode is used. Assume that when two datatypes are processed through an operator, the answer maintains the same datatype as the input datatypes. Assume that all datatypes have enough range to accommodate any number. If two different datatypes are operated on, the result assumes the more expressive datatype. 

What will be the output of the following pseudocode statements: integer a = 456, b, c, d =10 b = a/d c = a – b print c 

Option 1 : 410  Option 2 : 410.4  Option 3 : 411.4  Option 4 : 411  


Ques 13 : Choose the correct answer: A pseudocode is used. Assume that when two datatypes are processed through an operator, the answer maintains the same datatype as the input datatypes. Assume that all datatypes have enough range to accommodate any number. If two different datatypes are operated on, the result assumes the more expressive datatype. // in pseudo code refers to comment 

What will be the output of the following pseudocode statements: integer a = 984, b, c, d =10 print remainder(a,d) // remainder when a is divided by d a = a/d print remainder(a,d) // remainder when a is divided by d 

Option 1 : 48  Option 2 : Error  Option 3 : 84  Option 4 : 44  


Ques 14 : Choose the correct answer: Assume the following precedence (high to low). Operators in the same row have the same precedence: (.) * / + – AND OR For operators with equal precedence, the precedence is from lefttoright in expression. 

What will be the output of the following code statements?
integer a = 50, b = 25, c = 0 

Option 1 : 1  Option 2 : 0  Option 3 : 1  Option 4 : 10  


Ques 15 : Choose the correct answer: Assume the following precedence (high to low). Operators in the same row have the same precedence: (.) * / + – AND OR For operators with equal precedence, the precedence is from lefttoright in expression. 

What will be the output of the following code statements?
integer a = 50, b = 25, c = 5 

Option 1 : 120  Option 2 : 125  Option 3 : 255  Option 4 : 250  


Ques 16 : Choose the correct answer: Assume the following precedence (high to low). Operators in the same row have the same precedence: (.) * / + – AND OR For operators with equal precedence, the precedence is from lefttoright in expression. 

What will be the output of the following code statements?
integer a = 10, b = 35, c = 5 

Option 1 : 65  Option 2 : 60  Option 3 : Error  Option 4 : 70  


Ques 17 : Choose the correct answer: Assume the following precedence (high to low). Operators in the same row have the same precedence: (.) * / + – AND OR For operators with equal precedence, the precedence is from lefttoright in expression. 

integer a = 10, b = 35, c = 5 Comment about the output of the two statements? print a * b + c / d print c / d + a * b 

Option 1 : Differ due to lefttoright precedence  Option 2 : Differ by 10  Option 3 : Differ by 20  Option 4 : Same  


Ques 18 : Choose the correct answer: Assume the following precedence (high to low). Operators in the same row have the same precedence: (.) * / + – AND OR For operators with equal precedence, the precedence is from lefttoright in expression. 

integer a = 40, b = 35, c = 20, d = 10
Comment about the output of the following two statements: print a * b / c – d 

Option 1 : Differ by 80  Option 2 : Same  Option 3 : Differ by 50  Option 4 : Differ by 160  


Ques 19 : Choose the correct answer: Assume the following precedence (high to low). Operators in the same row have the same precedence: (.) * / + – AND OR For operators with equal precedence, the precedence is from lefttoright in expression. 

integer a = 60, b = 35, c = 30
What will be the output of the following two statements: 

Option 1 : 0 and 1  Option 2 : 0 and 0  Option 3 : 1 and 1  Option 4 : 1 and 0  


Ques 20 : Choose the correct answer: A pseudocode is used. Assume that when two datatypes are processed through an operator, the answer maintains the same datatype as the input datatypes. Assume that all datatypes have enough range to accommodate any number. If two different datatypes are operated on, the result assumes the more expressive datatype. // in pseudo code refers to comment 

What will be the output of the following pseudocode statements: integer a = 984, b=10 //float is a datatype to store real numbers. float c c = a / b print c 

Option 1 : 984  Option 2 : 98.4  Option 3 : 98  Option 4 : Error  


Ques 21 : Choose the correct answer: A pseudocode is used. Assume that when two datatypes are processed through an operator, the answer maintains the same datatype as the input datatypes. Assume that all datatypes have enough range to accommodate any number. If two different datatypes are operated on, the result assumes the more expressive datatype. // in pseudo code refers to comment 

What will be the output of the following pseudocode statements: integer a = 984 //float is a datatype to store rational numbers. float b= 10, c c = a / b print c 

Option 1 : 984  Option 2 : Error  Option 3 : 98.4  Option 4 : 98  


Ques 22 : Choose the correct answer  
Smriti wants to make a program to print the sum of square of the first 5 whole numbers (0…4). She writes the following program:
integer i = 0 // statement 1 Is her program correct? If not, which statement will you modify to correct it? 

Option 1 : No error, the program is correct.  Option 2 : Statement 1  Option 3 : Statement 4  Option 4 : statement 6  


Ques 23 : Choose the correct answer  
Shashi wants to make a program to print the sum of the first 10 multiples of 5. She writes the following program, where statement 5 is missing:
integer i = 0 Which of the following will you use for statement 5? 

Option 1 : i = 5  Option 2 : i = 5 * i  Option 3 : i = i + 1  Option 4 : i = i + 5  


Ques 24 : Choose the correct answer  
Shantanu wants to make a program to print the sum of the first 7 multiples of 6. He writes the following program:
integer i = 0 // statement 1 Does this program have an error? If yes, which one statement will you modify to correct the program? 

Option 1 : Statement 1  Option 2 : Statement 2  Option 3 : Statement 3  Option 4 : Statement 4  


Ques 25 : Choose the correct answer  
Sharmili wants to make a program to print the sum of all perfect cubes, where the value of the cubes go from 0 to 100. She writes the following program:
integer i = 0, a // statement 1 } Does this program have an error? If yes, which one statement will you modify to correct the program? 

Option 1 : Statement 1  Option 2 : Statement 2  Option 3 : Statement 3  Option 4 : Statement 4  Option 5 : No error 


Ques 26 : Choose the correct answer  
Bhavya wants to make a program to print the sum of all perfect squares, where the value of the squares go from 0 to 50. She writes the following program:
integer i = 1, a // statement 1 Does this program have an error? If yes, which one statement will you modify to correct the program? 

Option 1 : Statement 1  Option 2 : Statement 2  Option 3 : Statement 3  Option 4 : Statement 4  Option 5 : No error 


Ques 27 : Choose the correct answer  
Vijay wants to print the following pattern on the screen: 2 2 4 2 4 6 2 4 6 8He writes the following program:integer i = 1, j=2 // statement 1 while ( i <= 4 ) // statement 2 { j = 2; while ( j <= ? ) // Statement 3 { print j print blank space j = j + 2 } print endofline \takes the cursor to the next line i = i + 1 }What is the value of ? in statement 3 :: 

Option 1 : 8  Option 2 : i  Option 3 : 2*i  Option 4 : 4  


Ques 28 : Choose the correct answer  
Shravanti writes the following program:
integer i = 0, j What will be the output of the program? 

Option 1 : 0 0 3 
Option 2 : 0 3 0 3 6 
Option 3 : 0 0 3 6 0 3 6 9 
Option 4 : 0 3 6 0 3 6 9 0 3 6 9 12 



Ques 29 : Choose the correct answer  
Vijay wants to print the following pattern on the screen: 1 1 2 1 2 3He writes the following program:integer i = 1 // statement 1 while ( i <= 3 ) { int j // Statement 2 while ( j <= i ) // Statement 3 { print j print blank space j = j + 1 // Statement 4 } print endofline \takes the cursor to the next line i = i + 1 }Will this program function correctly? If not which one statement will you modify to make the program function correctly? 

Option 1 : Statement 1  Option 2 : Statement 2  Option 3 : Statement 3  Option 4 : Statement 4  Option 5 : Program does not have error. 


Ques 30 : Choose the correct answer  
Charu writes the following program:
integer i = 1, j, a What will be the output of the program? 

Option 1 : 2 2 4 2 4 8 2 4 8 16 
Option 2 : 2 4 2 4 8 2 4 8 16 2 4 8 16 32 
Option 3 : 2 4 2 4 8 2 4 8 2 4 8 16 
Option 4 : 2 2 4 2 4 2 4 8 16 



Ques 31 : Choose the correct answer  
Himanshu wants to write a program to print the larger of the two inputted number. He writes the following code:
int number1, number 2 

Option 1 : number1>number2  Option 2 : number2>number1  Option 3 : number2 equals number1  Option 4 : number1 <= number2  


Ques 32 : Choose the correct answer  
Shalini wants to program to print the largest number out of three inputted numbers. She writes the following program:
int number1, number 2, number3, temp; Fill in the ?? in Statement 1 

Option 1 : number3 > number2  Option 2 : number3 > temp  Option 3 : number3 < temp  Option 4 : number3 > number1 