Code Challenge @ 2k19

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Wisecc2k17
W
Wisecc2k17
Community Contributor
Quizzes Created: 1 | Total Attempts: 168
| Attempts: 168
SettingsSettings
Please wait...
  • 1/59 Questions

    Which of the following is called address operator?

    • *
    • &
    • _
    • %
Please wait...
C Quizzes & Trivia
About This Quiz

CODE CHALLENGE @ 2k19 is a quiz designed to assess knowledge in C programming, covering topics like functions, structures, scope, and operators. It is ideal for learners looking to test their understanding of basic to intermediate C programming concepts.


Quiz Preview

  • 2. 

    Which of the following is the scope resolution operator?

    • .

    • ::

    • &&

    • ~

    Correct Answer
    A. ::
    Explanation
    The scope resolution operator in C++ is "::". It is used to access members of a class or namespace that are defined outside of the class or namespace. It allows us to specify the scope in which the member is defined and helps in avoiding naming conflicts.

    Rate this question:

  • 3. 

    What is the output of this program? #include <iostream> usingnamespacestd; int main() { int a; a =5+3*5; cout<< a; return0; }

    • 35

    • 20

    • 25

    • 30

    Correct Answer
    A. 20
    Explanation
    The program calculates the value of "a" by performing the multiplication operation first, then the addition operation. The multiplication operation is 3*5, which results in 15. Then, the addition operation is performed by adding 5 to the result of the multiplication, which gives a final value of 20. Therefore, the output of the program is 20.

    Rate this question:

  • 4. 

    What is the maximum number of children that a binary tree node can have?

    • 0

    • 1

    • 2

    • 3

    Correct Answer
    A. 2
    Explanation
    A binary tree node can have a maximum of two children because it is a binary tree, which means each node can have at most two branches or children. In a binary tree, each node has a left child and a right child, or it can have no children at all. Therefore, the maximum number of children a binary tree node can have is 2.

    Rate this question:

  • 5. 

    Coding and decoding: If R is denoted by N, D is denoted by T, I by U, O by I, E by R, T by O, U by D, N by C and C by E, then how will the word INTRODUCE be written?  

    • UNCONIDTER

    • UCONITDER

    • UCONTIDER

    • UCOINTDER

    Correct Answer
    A. UCONITDER
    Explanation
    The word "INTRODUCE" is encoded based on the given coding scheme. Each letter is replaced with its corresponding letter according to the given mappings. Applying the mappings, the word "INTRODUCE" becomes "UCONITDER".

    Rate this question:

  • 6. 

    If several elements are competing for the same bucket in the hash table, what is it called?

    • Diffusion

    • Replication

    • Collision

    • None of the mentioned

    Correct Answer
    A. Collision
    Explanation
    When multiple elements are competing for the same bucket in a hash table, it is called a collision. This occurs when the hash function maps two or more elements to the same index in the hash table. Collisions are common in hash tables and need to be handled properly to ensure efficient retrieval and storage of data. Various collision resolution techniques, such as chaining or open addressing, can be used to address this issue.

    Rate this question:

  • 7. 

    Missing &Wrong Number Series: 1, 27, 125, ?, 729

    • 512 

    • 1331

    • 343

    • 216

    Correct Answer
    A. 343
    Explanation
    The given sequence is formed by raising the numbers 1, 3, 5, 7, 9 to the power of 3. The pattern is that each number in the sequence is obtained by cubing the next odd number. Therefore, the missing number in the sequence is 7, and its cube is 343.

    Rate this question:

  • 8. 

    Student(ID, name, dept name, tot_cred) In this query which attributes form the primary key?

    • Name

    • Dept

    • Tot_cred

    • ID

    Correct Answer
    A. ID
    Explanation
    The primary key in this query is ID. The primary key is a unique identifier for each record in a table, and it ensures the integrity and uniqueness of the data in the table. In this case, the ID attribute uniquely identifies each student in the table. The other attributes (name, dept name, tot_cred) are not mentioned to be part of the primary key, so they are not necessary for uniquely identifying the records.

    Rate this question:

  • 9. 

    Coding and decoding: If in a code language, COULD is written as BNTKC and MARGIN is written as LZQFHM, how will MOULDING be written in that code ?  

    • CHMFINTK

    • LNKTCHMF

    • LNTKCHMF

    • NITKHCMF

    Correct Answer
    A. LNTKCHMF
    Explanation
    In the given code language, each letter of the word is replaced by the previous letter in the English alphabet. Therefore, in the word "MOULDING", M becomes L, O becomes N, U becomes T, L becomes K, D becomes C, I becomes H, N becomes M, and G becomes F. Hence, the word "MOULDING" will be written as "LNTKCHMF" in that code.

    Rate this question:

  • 10. 

    What is the output of this program? #include <iostream> usingnamespacestd; int main() { int a =5, b =6, c, d; c = a, b; d =(a, b); cout<< c <<' '<< d; return0; }

    • 5 6

    • 6 5  

    • 6 7

    • None of the mentioned

    Correct Answer
    A. 5 6
    Explanation
    The program initializes variables a and b with the values 5 and 6 respectively. Then, the value of a is assigned to c, followed by the comma operator and the value of b. This means that c will be assigned the value of a (5) and then the value of b (6), resulting in c being 5.
    Next, the value of a is assigned to d, followed by the comma operator and the value of b. This means that d will be assigned the value of a (5) and then the value of b (6), resulting in d being 6.
    Finally, the values of c and d are printed, resulting in the output "5 6".

    Rate this question:

  • 11. 

    Coding and decoding: If MADRAS can be written as NBESBT, how can BOMBAY be written in that code ?  

    • CPNCBX

    • CPNCBZ

    • CPOCBZ

    • CQOCBZ

    Correct Answer
    A. CPNCBZ
    Explanation
    The given coding pattern is that each letter in the word is replaced with the letter that comes after it in the English alphabet. Applying this pattern to the word BOMBAY, each letter is replaced with the letter that comes after it, resulting in CPNCBZ.

    Rate this question:

  • 12. 

     What is the output of this program? class increment { public static void main(Stringargs[]) { int g =3; System.out.print(++g *8); } }

    • 25

    • 24

    • 32

    • 33

    Correct Answer
    A. 32
    Explanation
    The program declares a variable 'g' and assigns it the value of 3. The expression '++g' increments the value of 'g' by 1, resulting in 4. Then, the expression '4 * 8' is evaluated, which equals 32. Finally, the program prints the value of 32 as the output.

    Rate this question:

  • 13. 

    Modulus operator, %, can be applied to which of these?

    • Integers

    • Floating – point numbers

    • Both Integers and floating – point numbers

    • None of the mentioned

    Correct Answer
    A. Both Integers and floating – point numbers
    Explanation
    The modulus operator, %, can be applied to both integers and floating-point numbers. The modulus operator calculates the remainder when one number is divided by another. This operation is applicable to both integer and floating-point values, allowing us to determine the remainder of a division operation regardless of the type of number being used.

    Rate this question:

  • 14. 

    What is the output of the following? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i)

    • 0 1 2

    • Error

    • 0 1 2 0 1 2

    • None of the mentioned

    Correct Answer
    A. 0 1 2
    Explanation
    The output of the given code is "0 1 2".

    The code creates a generator object called "x" using a generator expression. The generator expression generates values from 0 to 2 (inclusive) using the range function.

    In the first for loop, the values generated by the generator object "x" are printed one by one, resulting in "0 1 2" being printed.

    However, in the second for loop, since the generator object "x" has already been exhausted in the previous loop, there are no more values to generate. Therefore, the second for loop does not execute and does not print anything.

    Rate this question:

  • 15. 

    What is the hash function used in the division method?

    • H(k) = k/m

    • H(k) = k mod m

    •  h(k) = m/k

    • H(k) = m mod k

    Correct Answer
    A. H(k) = k mod m
    Explanation
    The correct answer is h(k) = k mod m. In the division method of hash function, the key (k) is divided by the size of the hash table (m), and the remainder (mod) of this division is taken as the hash value. This ensures that the hash value falls within the range of the hash table size, allowing for an even distribution of keys across the table.

    Rate this question:

  • 16. 

     What will be the output of the following C code? #include <stdio.h> int main() { void foo(); printf("1 "); foo(); } void foo() { printf("2 "); }

    • 1 2

    • Compile time error

    • 1 2 1 2 

    • Depends on the compiler

    Correct Answer
    A. 1 2
    Explanation
    The code will output "1 2". The main function calls the foo function, which prints "2". Then, the main function continues and prints "1". Therefore, the output will be "1 2".

    Rate this question:

  • 17. 

    What is the output of below program?  def writer():  title = 'Sir'  name = (lambda x:title + ' ' + x) 4. return name 5. 6. who = writer() 7. who('Arthur')

    • Arthur Sir

    • Sir Arthur

    • Arthur

    • None of the mentioned

    Correct Answer
    A. Sir Arthur
    Explanation
    The program defines a function called "writer" which creates a lambda function that takes an argument "x" and returns the concatenation of the variable "title" (which is "Sir") and a space, followed by the argument "x". The function "writer" then returns this lambda function.
    On line 6, the variable "who" is assigned the result of calling the "writer" function.
    On line 7, the "who" variable is called as a function with the argument "Arthur".
    Therefore, the output of the program will be "Sir Arthur".

    Rate this question:

  • 18. 

    Missing & Wrong Number Series: 2.5, 3.5, 15, 60, 300, 1800

    • 3.5

    • 15

    • 2.5

    • 300

    Correct Answer
    A. 3.5
    Explanation
    The given series follows a pattern where each number is obtained by multiplying the previous number by a certain factor. In this case, the pattern seems to be multiplying the previous number by 1, then by 5, then by 4, then by 5, and so on. Starting with 2.5, when we multiply it by 1, we get 2.5. Then, when we multiply 2.5 by 5, we get 12.5. Continuing this pattern, when we multiply 12.5 by 4, we get 50. Finally, when we multiply 50 by 5, we get 250. Therefore, the next number in the series should be obtained by multiplying 250 by 4, which gives us 1000. However, since this number is not provided as an option, the correct answer is 3.5, which does not follow the pattern but fits the given sequence.

    Rate this question:

  • 19. 

    Directions: The length and breadth of a room are 8 m and 6 m respectively. A cat runs along all the four walls and finally along a diagonal order to catch a rat. How much total distance is covered by the cat?  

    • 10

    • 14

    • 38

    • 48

    Correct Answer
    A. 48
    Explanation
    The cat runs along all four walls of the room, which means it covers a distance of 8+8+6+6 = 28 meters. After that, it runs along the diagonal, which can be calculated using the Pythagorean theorem. The diagonal is the hypotenuse of a right triangle with sides 8 and 6. Using the formula a^2 + b^2 = c^2, we get 8^2 + 6^2 = c^2. Simplifying, we get 64 + 36 = c^2, which gives us c = √100 = 10. Therefore, the cat covers an additional distance of 10 meters along the diagonal. Adding the distances, we get 28 + 10 = 38 meters. However, the cat runs along the diagonal twice, so the total distance covered is 38 * 2 = 48 meters.

    Rate this question:

  • 20. 

    Identify the wrong sentence: Implementation of these measures /2) may help the Govt /3) to generating a revenue of /4) about Rs. 400 crores a year.  

    • Implementation of these measures

    • May help the Govt

    • To generating a revenue of

    • About Rs. 400 crores a year.

    Correct Answer
    A. To generating a revenue of
    Explanation
    The sentence "to generating a revenue of" is grammatically incorrect. The correct form should be "to generate a revenue of" as the verb "generate" should be in its base form after the preposition "to".

    Rate this question:

  • 21. 

    Which variable has the longest scope in the following C code? #include <stdio.h> int b; int main() { int c; return0; } int a;

    • A

    • B

    • C

    • Both a and b

    Correct Answer
    A. Both a and b
    Explanation
    In the given C code, the variables 'a' and 'b' have the longest scope. 'a' is declared outside of any function, making it a global variable with a scope that extends throughout the entire program. 'b' is also declared outside of any function, giving it the same global scope as 'a'. Therefore, both 'a' and 'b' have the longest scope in the code.

    Rate this question:

  • 22. 

    Which function will you choose to join two words?

    • Strcpy()

    • Strcat()

    • Strncon()

    • Memcon()

    Correct Answer
    A. Strcat()
    Explanation
    The strcat() function is used to concatenate (join) two strings together. It takes two arguments - the destination string and the source string, and appends the source string to the end of the destination string. Therefore, in order to join two words, strcat() would be the appropriate function to choose.

    Rate this question:

  • 23. 

    Which of the following is accessed by a member function of a class?

    • The object of that class

    • All members of a class

    • The public part of a class

    • The private part of a class

    Correct Answer
    A. All members of a class
    Explanation
    A member function of a class can access all members of that class, including both the public and private parts. This means that the member function can access and manipulate variables, functions, and other members of the class, regardless of their access level. Therefore, the correct answer is that a member function can access all members of a class.

    Rate this question:

  • 24. 

    Blood relations: Pointing to a man in a photograph. Asha said."His mother's only daughter is my mother". How is Asha related to that man ?   

    • Nephew

    • Sister

    • Wife

    • Niece

    Correct Answer
    A. Niece
    Explanation
    Asha is saying that the mother of the man in the photograph is her mother. So, Asha's mother is the mother of the man. Since Asha is the daughter of her mother, it means that Asha is the sister of the man in the photograph. Therefore, Asha is the niece of the man.

    Rate this question:

  • 25. 

    What is the output of the following? i = 5 while True: if i%0O9 == 0: break print(i) i += 1

    • 5 6 7 8

    • 5 6 7 8 9

    • 5 6 7 8 9 10 11 12 13 14 15 ....

    • Error

    Correct Answer
    A. Error
    Explanation
    The code will result in an error because there is an indentation error. The "if" statement inside the "while" loop is not indented properly, causing a syntax error.

    Rate this question:

  • 26. 

    Identify the wrong sentence: The presiding officer /2) replied that everything depended /3) on him receiving /4) the reply on time.  

    • The presiding officer

    • Replied that everything depended

    • On him receiving

    • The reply on time

    Correct Answer
    A. On him receiving
    Explanation
    The correct answer is "on him receiving". This sentence is incorrect because the preposition "on" should be followed by a noun or pronoun, not a verb form. The correct sentence should be "on his receiving" or "on receiving".

    Rate this question:

  • 27. 

    Directions: A man is facing north-west. He turns 90o in the clockwise direction, then 180o in the anticlockwise direction and then another 90o in the same direction. Which direction is he facing now?  

    • South

    • South-west

    • South-east

    • East

    Correct Answer
    A. South-east
    Explanation
    After turning 90 degrees clockwise, the man is now facing north. Then, after turning 180 degrees anticlockwise, he is facing south. Finally, after turning another 90 degrees anticlockwise, he is facing east. Therefore, the man is facing south-east now.

    Rate this question:

  • 28. 

    A train 125 m long passes a man, running at 5 km/hr in the same direction in which the train is going, in 10 seconds. The speed of the train is:  

    • 54 km/hr

    • 50 km/hr

    • 45 km/hr

    • 55 km/hr

    Correct Answer
    A. 50 km/hr
    Explanation
    The man is running in the same direction as the train, so his speed needs to be subtracted from the relative speed of the train to calculate the speed of the train. The length of the train is given as 125 m and the time taken to pass the man is given as 10 seconds. We can use the formula speed = distance/time to calculate the speed of the train. The distance covered by the train in 10 seconds is 125 m. Converting the speed of the man from km/hr to m/s, we get 5 km/hr = (5 * 1000) / (60 * 60) = 1.39 m/s. Subtracting the speed of the man from the speed of the train, we get 125/10 - 1.39 = 12.5 - 1.39 = 11.11 m/s. Converting this back to km/hr, we get (11.11 * 60 * 60) / 1000 = 40 km/hr. Therefore, the speed of the train is 40 km/hr.

    Rate this question:

  • 29. 

    Two trains running in opposite directions cross a man standing on the platform in 27 seconds and 17 seconds respectively and they cross each other in 23 seconds. The ratio of their speeds is:  

    • 1 : 3

    • 3 : 2

    • 3 : 4

    • None of these

    Correct Answer
    A. 3 : 2
    Explanation
    The ratio of the speeds of the two trains can be determined by using the concept of relative speed. When the two trains are crossing each other, their combined speed is equal to the sum of their individual speeds. Therefore, the ratio of their speeds is inversely proportional to the time taken to cross each other. In this case, the first train takes 27 seconds to cross the man, while the second train takes 17 seconds. The ratio of their speeds is 27:17, which simplifies to 3:2. Therefore, the correct answer is 3:2.

    Rate this question:

  • 30. 

    Time and Work; A is thrice as good as workman as B and therefore is able to finish a job in 60 days less than B. Working together, they can do it in:

    •  20 days

    • 22 1/2  days

    • 25days

    • 30 days

    Correct Answer
    A. 30 days
    Explanation
    Since A is thrice as good as B, it means that A can complete 3 times the work that B can complete in the same amount of time. Let's assume that B takes x days to complete the job. Therefore, A will take x/3 days to complete the job. It is given that A can finish the job in 60 days less than B, so we can set up the equation x - x/3 = 60. Solving this equation, we find that x = 90. So, B takes 90 days to complete the job, and A takes 30 days. When they work together, they can complete 1/90 + 1/30 = 1/30 of the job per day. Therefore, they can complete the job in 30 days.

    Rate this question:

  • 31. 

     With x = 0, which of the following are legal lines of Java code for changing the value of x to 1? x++; x= x +1; x+=1; x=+1;

    • 1, 2 & 3

    • 1 & 4

    • 1, 2, 3 & 4

    • 3 & 2

    Correct Answer
    A. 1, 2, 3 & 4
    Explanation
    All of the given options are legal lines of Java code for changing the value of x to 1.

    1) x++ increments the value of x by 1.
    2) x = x + 1 assigns the value of x + 1 to x.
    3) x += 1 is a shorthand notation for x = x + 1.
    4) x=+1 is equivalent to x = +1, which assigns the value of +1 to x.

    Rate this question:

  • 32. 

    Look ! A hamster ______ by a cat.  

    • Has been chased

    • Was being chased

    • Is being chased

    • Is chased

    Correct Answer
    A. Is being chased
    Explanation
    The given correct answer is "is being chased". This is because the sentence is in the present tense and the action of the hamster being chased by the cat is happening right now. The phrase "is being chased" indicates that the action is currently taking place.

    Rate this question:

  • 33. 

    Which of the following are themselves a collection of different data types?

    • String

    • Structures

    • Char

    • All of the mentioned

    Correct Answer
    A. Structures
    Explanation
    Structures are a collection of different data types. They allow us to combine different variables of different data types into a single unit. This makes it easier to organize and manipulate related data. Structures can contain variables such as integers, floats, characters, and even other structures. Therefore, the correct answer is structures.

    Rate this question:

  • 34. 

    Blood relations: P is the brother of Q and R. S is R's mother. T is P's father. Which of the following statements cannot be definitely true ?   

    • T is Q's father

    • Q is T's son

    • P is S's son

    • S is P's mother

    Correct Answer
    A. Q is T's son
    Explanation
    The given information states that P is the brother of Q and R, S is R's mother, and T is P's father. From this information, we can conclude that Q is T's son. Therefore, the statement "Q is T's son" can be definitely true. Hence, the statement "Q is T's son" cannot be definitely true.

    Rate this question:

  • 35. 

     What is the output of this program? class increment { publicstaticvoid main(Stringargs[]) { double var1 =1+5; double var2 = var1 /4; int var3 =1+5; int var4 = var3 /4; System.out.print(var2 +" "+ var4); } }

    • 1 1

    • 0 1

    • 1.5 1

    • 1.5 1.0

    Correct Answer
    A. 1.5 1
    Explanation
    The program first assigns the value of 1 + 5 to the variable var1, which results in 6. Then, it assigns the value of var1 divided by 4 to the variable var2, which is 6/4 = 1.5.

    Similarly, the program assigns the value of 1 + 5 to the variable var3, which is 6. Then, it assigns the value of var3 divided by 4 to the variable var4, which is 6/4 = 1.

    Finally, the program prints the values of var2 and var4, which are 1.5 and 1 respectively.

    Rate this question:

  • 36. 

    Blood relations: Pointing out to a lady, a girl said,"She is the daughter-in-law of the grandmother of my father's only son", How is the lady related to the girl ?  

    • Sister-in-law

    • Mother

    • Aunt

    • Can't be determined

    Correct Answer
    A. Mother
    Explanation
    The lady is the mother of the girl. The girl states that the lady is the daughter-in-law of the grandmother of her father's only son. Since the girl is referring to herself as "my father's only son," it means that the girl is the daughter of the lady. Therefore, the lady is the girl's mother.

    Rate this question:

  • 37. 

    How many orders of traversal are applicable to a binary tree (In General)?

    • 1

    • 4

    • 2

    • 3

    Correct Answer
    A. 3
    Explanation
    There are three orders of traversal applicable to a binary tree in general: pre-order traversal, in-order traversal, and post-order traversal. Pre-order traversal visits the root node first, then the left subtree, and finally the right subtree. In-order traversal visits the left subtree first, then the root node, and finally the right subtree. Post-order traversal visits the left subtree first, then the right subtree, and finally the root node.

    Rate this question:

  • 38. 

    Directions: A man walks 5 km toward south and then turns to the right. After walking 3 km he turns to the left and walks 4 km. And then he goes back 10 km straight. Now in which direction is he from the starting place ?  

    • South-East

    • North-West

    • South

    • West

    Correct Answer
    A. North-West
    Explanation
    The man initially walks 5 km towards the south. Then, he turns right and walks 3 km, followed by a left turn and walking 4 km. Finally, he goes back 10 km straight. Since he went back straight, it means he walked in the opposite direction of his previous steps. Therefore, he is now in the opposite direction of south, which is north. Additionally, he is also in the opposite direction of the last turn he made, which was left (west). Therefore, the man is in the north-west direction from the starting place.

    Rate this question:

  • 39. 

    Which of the following cannot be a structure member?

    • Another structure

    • Function

    • Array

    • None of the mentioned

    Correct Answer
    A. Function
    Explanation
    A function cannot be a structure member because a structure is a user-defined data type that can contain variables of different data types. Functions, on the other hand, are blocks of code that perform a specific task and can be called from other parts of the program. They are not variables and therefore cannot be members of a structure.

    Rate this question:

  • 40. 

    Identify the wrong sentence 1) When we reached /2) the station, the /3) train arrived /4) before time.  

    • When we reached

    • The station, the

    •  train arrived

    •  before time

    Correct Answer
    A.  train arrived
    Explanation
    The sentence "train arrived" is incorrect because it does not have an article before the noun "train." It should be "the train arrived" to indicate a specific train.

    Rate this question:

  • 41. 

    Time and Work; A can lay railway track between two given stations in 16 days and B can do the same job in 12 days. With help of C, they did the job in 4 days only. Then, C alone can do the job in:  

    • 9 1/5  days

    • 9 2/5  days

    • 9 3/5  days

    • 10 days

    Correct Answer
    A. 9 3/5  days
    Explanation
    C's efficiency can be calculated by using the formula: 1/C = 1/A + 1/B.
    Substituting the given values, we get: 1/C = 1/16 + 1/12.
    Simplifying, we get: 1/C = 7/48.
    Therefore, C can do the job in 48/7 days.
    Converting this into a mixed fraction, we get: 6 6/7 days.
    Converting this into an improper fraction, we get: 48/7 days.
    Converting this into a mixed fraction, we get: 9 3/5 days. Therefore, the correct answer is 9 3/5 days.

    Rate this question:

  • 42. 

    Directions: K is 40 m South-West of L. If M is 40 m South-East of L, then M is in which direction of K?  

    • East

    • West

    • North-East

    • South

    Correct Answer
    A. East
    Explanation
    If K is 40 m South-West of L and M is 40 m South-East of L, then M is located between K and L. Since M is to the east of L and K is to the west of L, M is in the east direction of K.

    Rate this question:

  • 43. 

    Identify the wrong sentence a. Sheeps is sold cheaper than goat b. Sheep are sold cheaper than goat c. Sheeps are sold cheaper than goat d. Sheep is sold cheaper than goat

    • AC are wrong

    • AB are wrong

    • CD are wrong

    • BD are wrong

    Correct Answer
    A. AC are wrong
    Explanation
    The correct answer is AC are wrong. In option a, the word "sheeps" is incorrect as the plural form of sheep is still "sheep." In option c, the verb "are" should be used instead of "is" to agree with the plural subject "sheep."

    Rate this question:

  • 44. 

    What is the output of this program? class Output { public static void main(Stringargs[]) { int a,b,c,d; a=b=c=d=20 a+=b-=c*=d/=20 System.out.println(a+" "+b+" "+c+" "+d); } }

    • Compile time error

    • Runtime error

    • A=20 b=0 c=20 d=1

    • None of the mentioned

    Correct Answer
    A. A=20 b=0 c=20 d=1
    Explanation
    The program will output "a=20 b=0 c=20 d=1". This is because the program assigns the value of 20 to variables a, b, c, and d. Then, it performs the following operations: b-=c*=d/=20. This is equivalent to b = b - (c * (d / 20)), which simplifies to b = 0 - (20 * (1 / 20)), and further simplifies to b = 0 - (20 * 0.05), and finally b = 0 - 1. Therefore, the value of b becomes 0. The other variables remain unchanged.

    Rate this question:

  • 45. 

    Coding and decoding: Acording to a military code, SYSTEM is SYSMET and NEARER is AENRER. What is the code for FRACTION ?  

    • CARFTINO

    • CARFTION

    • ARFCNOIT

    • CARFNOIT

    Correct Answer
    A. CARFNOIT
    Explanation
    The given question is based on a specific coding pattern. In this pattern, the letters in the word are rearranged in a specific order. The rearrangement is done by taking the first letter, then the last letter, then the second letter, then the second-to-last letter, and so on. Applying this pattern to the word "FRACTION" gives us "CARFNOIT". Therefore, the correct answer is "CARFNOIT".

    Rate this question:

  • 46. 

    ________ matches the start of the string. ________ matches the end of the string.

    • ‘^’, ‘$’

    • ‘$’, ‘^’

    • ‘$’, ‘?’

    • ‘?’, ‘^’

    Correct Answer
    A. ‘^’, ‘$’
    Explanation
    The symbol "^" matches the start of the string, while the symbol "$" matches the end of the string.

    Rate this question:

  • 47. 

    What is the output of this program? class Output { public static void main(Stringargs[]) { int a =1; int b =2; int c; int d; c =++b; d = a++; c++; b++; ++a; System.out.println(a +" "+ b +" "+ c); } }

    • 3 2 4

    • 3 2 3 

    • 2 3 4

    • 3 4 4 

    Correct Answer
    A. 3 4 4 
    Explanation
    The program starts by initializing variables a and b with the values 1 and 2 respectively. Then, it assigns the value of b incremented by 1 to the variable c (c = ++b), making c equal to 3. Next, it assigns the value of a to the variable d and then increments the value of a by 1 (d = a++). After that, it increments the values of both c and b by 1 (c++ and b++). Finally, it increments the value of a by 1 (++a). The program then prints the values of a, b, and c, which are 3, 4, and 4 respectively.

    Rate this question:

  • 48. 

    ______ is a special type of integrity constraint that relates two relations & maintains consistency across the relations.

    • Entity Integrity Constraints

    • Referential Integrity Constraints

    • Domain Integrity Constraints

    • Domain Constraints

    Correct Answer
    A. Referential Integrity Constraints
    Explanation
    Referential Integrity Constraints are a special type of integrity constraint that ensure consistency between two relations in a database. These constraints enforce the relationship between the primary key in one relation and the foreign key in another relation. They ensure that any value in the foreign key column of the dependent relation must exist as a primary key value in the referenced relation. This maintains data integrity and prevents inconsistencies or orphaned records in the database.

    Rate this question:

  • 49. 

    Missing & Wrong Number Series: 3240, 540, 108, 27, ?, 4.5

    • 7

    •  8

    • 9

    • 10

    Correct Answer
    A.  8
    Explanation
    The given number series follows a pattern where each number is divided by 6 to get the next number. Starting with 3240, dividing it by 6 gives 540, then dividing 540 by 6 gives 108, and so on. Continuing this pattern, dividing 27 by 6 gives 4.5. Therefore, the missing number in the series is 27 divided by 6, which is 4.5.

    Rate this question:

Quiz Review Timeline (Updated): Mar 16, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 16, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 18, 2019
    Quiz Created by
    Wisecc2k17
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.