# PGDCA 2nd Semester Exam 09/03/2020

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By PHULBANIOCA
P
PHULBANIOCA
Community Contributor
Quizzes Created: 3 | Total Attempts: 589
Questions: 40 | Attempts: 103

Settings

Questions and Answers
• 1.

### An algorithm is best described as:

• A.

A Computer language

• B.

A step by step procedure for solving a problem

• C.

A branch of mathematics

• D.

None of the above

Correct Answer
B. A step by step procedure for solving a problem
Explanation
An algorithm is a set of instructions or a step-by-step procedure that is used to solve a problem or perform a specific task. It is not a computer language, as it can be implemented in various programming languages. While it may involve mathematical concepts or be used in mathematical calculations, it is not solely a branch of mathematics. Therefore, the correct answer is that an algorithm is a step-by-step procedure for solving a problem.

Rate this question:

• 2.

### Which of the following is related to machine language?

• A.

Difficult to learn

• B.

First Generation language

• C.

Machine Dependent

• D.

All of the above

Correct Answer
D. All of the above
Explanation
All of the options mentioned are related to machine language. Machine language is difficult to learn as it consists of low-level instructions that are specific to a particular computer architecture. It is also considered a first-generation language as it was the first type of programming language used to communicate with computers. Additionally, machine language is machine-dependent, meaning it is designed for a specific computer system and cannot be executed on other machines without modification. Therefore, all of the given options are correct in relation to machine language.

Rate this question:

• 3.

### Product of matrices A(m x n) and B(n x p) will be matrix C with row and column as:

• A.

M and p

• B.

N and p

• C.

P and n

• D.

None of the above

Correct Answer
A. M and p
Explanation
The product of matrices A(m x n) and B(n x p) will result in a matrix C with m rows and p columns. This is because the number of rows in matrix A must match the number of columns in matrix B in order for the multiplication to be defined. The resulting matrix C will have the same number of rows as matrix A and the same number of columns as matrix B, which is m and p respectively.

Rate this question:

• 4.

### The operator && in 'C' language is a

• A.

OR operator

• B.

Not operator

• C.

AND operator

• D.

None of the above

Correct Answer
C. AND operator
Explanation
The operator && in 'C' language is the AND operator. This operator is used to combine two conditions and returns true only if both conditions are true. If either of the conditions is false, the result will be false. Therefore, the correct answer is AND operator.

Rate this question:

• 5.

### If A=5 and B=++A, the value of A and B

• A.

6,6

• B.

5,6

• C.

6,5

• D.

5,5

Correct Answer
A. 6,6
Explanation
When A=5 and B=++A, the value of A is incremented by 1 before assigning it to B. Therefore, the value of A becomes 6 and B is also assigned the value of 6. Hence, the correct answer is 6,6.

Rate this question:

• 6.

### Choose the odd one out

• A.

A=a+1

• B.

A+=1

• C.

A++

• D.

A=+1

Correct Answer
D. A=+1
Explanation
The given options a=a+1, a+=1, and a++ all increment the value of 'a' by 1. However, a=+1 is different because it assigns the value of +1 to 'a' instead of incrementing its current value.

Rate this question:

• 7.

### The expression, i=30*10+27; evaluates to:

• A.

327

• B.

-327

• C.

810

• D.

0

Correct Answer
A. 327
Explanation
The expression i=30*10+27 evaluates to 327. This is because the multiplication operation is performed first, resulting in 300. Then, the addition operation is performed, adding 27 to 300, resulting in the final value of 327.

Rate this question:

• 8.

### BCPL

• A.

Is a low level language

• B.

Is an assembly language

• C.

Basic Combined Programming Language

• D.

Both b and c

Correct Answer
C. Basic Combined Programming Language
Explanation
BCPL stands for Basic Combined Programming Language. It is a programming language that was developed in the 1960s and was widely used for system programming. BCPL is considered a low-level language because it provides low-level control over the computer's hardware and memory. It is not an assembly language, which is a type of low-level language that is specific to a particular computer architecture. Therefore, the correct answer is "Basic Combined Programming Language."

Rate this question:

• 9.

### Choose the odd one out

• A.

If

• B.

If-else

• C.

While

• D.

Switch--case

Correct Answer
C. While
Explanation
The given options consist of different control structures used in programming. "while" is the odd one out because it is the only option that is a looping construct, while the others are conditional statements or decision-making constructs. "if" is used for making a decision based on a condition, "if-else" is used for making a decision with two possible outcomes, and "switch-case" is used for making a decision with multiple possible outcomes. "while" is used for repeating a block of code until a certain condition is met.

Rate this question:

• 10.

### While(1) { }

• A.

Valid

• B.

Invalid

• C.

Semicolon required

• D.

None of the above

Correct Answer
A. Valid
Explanation
The given code snippet is a while loop with a condition of "1", which means the loop will continue indefinitely. This is a valid construct in many programming languages, including C, C++, and Java. The loop body is empty, but it is still considered valid code.

Rate this question:

• 11.

### Break used

• A.

Forces the program to exit

• B.

Construction

• C.

Forces the statement to come out

• D.

None of the above

Correct Answer
C. Forces the statement to come out
Explanation
The correct answer "Forces the statement to come out" explains that the use of the "break" keyword in programming is used to exit a loop or switch statement prematurely. When the "break" statement is encountered, the program will immediately exit the loop or switch statement and continue executing the next line of code after the loop or switch. This allows for conditional termination of a loop or skipping the remaining cases in a switch statement.

Rate this question:

• 12.

### For(; ;)

• A.

Needs to terminate

• B.

Valid

• C.

Not valid

• D.

None of the above

Correct Answer
B. Valid
Explanation
The given code snippet is a for loop with no initialization, condition, or increment statement. This means that the loop will run indefinitely, as there is no condition to stop it. Therefore, the statement "valid" is correct, as the code will continue to execute without terminating.

Rate this question:

• 13.

### Int a[3]={1,2,3}; printf("%d",a[3]);

• A.

1

• B.

3

• C.

0

• D.

None of the above

Correct Answer
C. 0
Explanation
The given code initializes an array "a" with 3 elements {1, 2, 3}. However, when trying to print the value at index 3 (a[3]), it is accessing a memory location beyond the size of the array. This results in undefined behavior. In this case, it prints the value 0, which is likely the value stored in the memory location immediately after the array.

Rate this question:

• 14.

### The string is terminated automatically in the memory

• A.

By NULL

• B.

By zero

• C.

Both a and b

• D.

None of the above

Correct Answer
A. By NULL
Explanation
In programming, strings are typically stored as arrays of characters. In order to indicate the end of a string, a special character called NULL is used. When a string is terminated by NULL, it means that the last character of the string is followed by a NULL character, which serves as a marker to indicate the end of the string. This allows programs to know where the string ends and prevents any unexpected behavior when manipulating or accessing the string. Therefore, the correct answer is "By NULL".

Rate this question:

• 15.

### Matrix is

• A.

One form of the One dimension array

• B.

Combination of row and column

• C.

Both a and b

• D.

None of the above

Correct Answer
B. Combination of row and column
Explanation
A matrix is a combination of rows and columns. It is a two-dimensional array that is arranged in a rectangular form, where each element is identified by its row and column index. The rows represent the horizontal dimension, while the columns represent the vertical dimension. Therefore, a matrix is not just a one-dimensional array, but rather a structure that combines both rows and columns to organize and represent data.

Rate this question:

• 16.

### Which of the following is the correct order of evaluation for the below expression z=x+y*z/4%2-1

• A.

*/%+-=

• B.

/*%-+=

• C.

=*/%+-

• D.

*%/-+=

Correct Answer
A. */%+-=
Explanation
The correct order of evaluation for the expression "z=x+y*z/4%2-1" is as follows: first, the multiplication ( * ) and division ( / ) operations are performed from left to right, then the modulo ( % ) operation is performed, followed by the addition ( + ) and subtraction ( - ) operations. Finally, the result is assigned to the variable z ( = ).

Rate this question:

• 17.

### Which of the following is the correct order if calling a function in the below code? a= f1(23,14)* f2 (12/4) +f3();

• A.

F1,f2,f3

• B.

F3,f2,f1

• C.

Order may vary from compiler to compiler

• D.

None of the above

Correct Answer
A. F1,f2,f3
Explanation
The correct order of calling the functions in the given code is f1, f2, f3. This is because the function f1 is called with the arguments 23 and 14, then the function f2 is called with the result of the division operation 12/4, and finally the function f3 is called without any arguments.

Rate this question:

• 18.

### How many times "IndiaBIX" is get printed int main() {  int x; for (x=-1;x<=10;x++) {   if(x<5)  continue;  else break;  printf("IndiaBix"); } return 0; }

• A.

Infinite times

• B.

0 times

• C.

11 times

• D.

10 times

Correct Answer
B. 0 times
Explanation
The loop starts with x=-1 and continues until x

Rate this question:

• 19.

### What do the following declaration signify? void *cmp();

• A.

Cmp is a pointer to an void type

• B.

Cmp is a void type pointer variable

• C.

Cmp is a function that return a void pointer

• D.

Cmp function returns nothing

Correct Answer
C. Cmp is a function that return a void pointer
Explanation
The declaration "void *cmp();" signifies that cmp is a function that returns a void pointer. The return type of the function is void *, indicating that the function will return a pointer to an unspecified type.

Rate this question:

• 20.

### When the following piece of code is executed, what output will be generated? #include<stdio.h> int main() {  char arr[7]="Network"; printf("%s",arr); return 0; }

• A.

Network

• B.

N

• C.

Garbage value

• D.

Compilation error

Correct Answer
C. Garbage value
Explanation
When the code is executed, it will print the string "Network" because the character array "arr" is initialized with the string "Network". The printf statement will print the string using the "%s" format specifier. There will not be any garbage value printed in this case.

Rate this question:

• 21.

### The result of Relational operation is always

• A.

Either true or false

• B.

Is less than or is more than

• C.

Is equal or less or more

• D.

All of the above

Correct Answer
A. Either true or false
Explanation
The result of a relational operation is always either true or false because relational operations compare two values and determine whether they satisfy a specific relationship, such as less than, greater than, or equal to. The comparison can only have two outcomes: either the relationship is true or it is false. Therefore, the correct answer is "Either true or false."

Rate this question:

• 22.

### The keyword used to transfer control from a function back to the calling function is

• A.

Switch

• B.

Goto

• C.

Go back

• D.

Return

Correct Answer
D. Return
Explanation
The keyword "return" is used to transfer control from a function back to the calling function. When a function is called, the program execution moves to that function and starts executing the statements inside it. The "return" keyword is used to exit the function and return the control back to the calling function. It can also be used to return a value from the function to the calling function.

Rate this question:

• 23.

### What is the similarity between a structure, union and enumeration?

• A.

All of them let you define new values

• B.

All of them let you define new data types

• C.

All of them let you define new pointer

• D.

All of them let you define new structure

Correct Answer
B. All of them let you define new data types
Explanation
All of the options mentioned in the question (structure, union, and enumeration) allow the programmer to define new data types. These data types can be used to create variables and store values of different types in memory. By defining new data types, it becomes easier to organize and manipulate data in a program, increasing code readability and maintainability.

Rate this question:

• 24.

### Which of the following cannot be used as identifiers?

• A.

Spaces

• B.

Underscores

• C.

Digits

• D.

Letters

Correct Answer
C. Digits
Explanation
Digits cannot be used as identifiers because identifiers in programming languages are typically used to represent variables, functions, or other entities, and they must follow certain rules. One of these rules is that an identifier cannot start with a digit. It can only start with a letter or an underscore. However, digits can be used within an identifier after the first character.

Rate this question:

• 25.

### How many times is a do while loop guaranteed to loop

• A.

0

• B.

Infinitely

• C.

1

• D.

Variable

Correct Answer
A. 0
Explanation
A do-while loop is guaranteed to loop at least once because the condition is checked at the end of the loop. However, if the condition is false after the first iteration, the loop will not execute again. Therefore, the correct answer is 0, indicating that the loop may not execute more than once.

Rate this question:

• 26.

### In the passage of text, individual words and punctuation marks are known as

• A.

Constants

• B.

Keywords

• C.

Operators

• D.

Token

Correct Answer
B. Keywords
Explanation
In the passage of text, individual words and punctuation marks are known as keywords. Keywords are specific words or phrases that have a predefined meaning in a programming language. They are used to define the structure and behavior of the program. Examples of keywords in programming languages include "if," "else," "for," "while," and "return." These keywords cannot be used as variable names or identifiers because they have a special meaning in the language.

Rate this question:

• 27.

### Which of the following are not valid variable names in C?

• A.

Float_int,keyword, A1

• B.

Valid, variable, name

• C.

ANSI, ASCII,CPU

• D.

All of the above

Correct Answer
D. All of the above
Explanation
All of the options mentioned are not valid variable names in C. In C, variable names cannot contain special characters or spaces. The option "float_int" violates this rule by having an underscore between two words. "keyword" is not a valid variable name as it is a reserved keyword in C. "A1" is a valid variable name as it starts with a letter and can contain letters, numbers, and underscores. The options "ANSI", "ASCII", and "CPU" are not valid variable names as they consist entirely of capital letters, which is not allowed in C. Therefore, the correct answer is "All of the above".

Rate this question:

• 28.

### When we declare an array

• A.

Compiler declare array name itself as a constant pointer to base address

• B.

A continuous file is allocated to store the elements value

• C.

Index of elements is declared automatically

• D.

All elements are initialized to zero

Correct Answer
A. Compiler declare array name itself as a constant pointer to base address
Explanation
When we declare an array, the compiler automatically declares the array name itself as a constant pointer to the base address. This means that the array name represents the memory address of the first element in the array. Additionally, a continuous block of memory is allocated to store the values of the elements in the array. The index of the elements is declared automatically, allowing us to access specific elements using their index values. Finally, when the array is declared, all the elements are initialized to zero by default.

Rate this question:

• 29.

### The C statements printf (" The value= %x",62); will print

• A.

The value=62

• B.

The value=O62

• C.

The value =0x3C

• D.

The value=3C

Correct Answer
D. The value=3C
Explanation
The printf statement with the format specifier "%x" will print the hexadecimal representation of the number 62. In hexadecimal, the number 62 is represented as "3C". Therefore, the correct answer is "The value=3C".

Rate this question:

• 30.

### Macros are defined using

• A.

#define

• B.

#include

• C.

#if

• D.

#ifdef

Correct Answer
A. #define
Explanation
Macros in programming are defined using the #define directive. This directive allows programmers to create symbolic names or constants that can be used throughout the code. The #define directive is used to define a macro and associate it with a specific value or code snippet. This allows for easier code maintenance and readability, as the macro can be used instead of writing the value or code snippet repeatedly.

Rate this question:

• 31.

### Which of the following datatype is a structured data type with heterogeneous elements

• A.

Array

• B.

Structure

• C.

Enum

• D.

Pointer

Correct Answer
B. Structure
Explanation
A structure is a datatype that allows us to combine different types of variables into a single entity. It is considered a structured data type because it can contain heterogeneous elements, meaning it can store variables of different data types within it. This allows for the organization and grouping of related data, making it easier to manage and access. In contrast, an array is a data structure that stores elements of the same data type, an enum is an enumerated type that represents a set of named values, and a pointer is a variable that stores the memory address of another variable.

Rate this question:

• 32.

### The default return type of main() is

• A.

Int

• B.

Char

• C.

Void

• D.

Float

Correct Answer
A. Int
Explanation
The default return type of the main() function in C++ is int. This means that the main() function is expected to return an integer value to the operating system when the program terminates.

Rate this question:

• 33.

### In C program, all variable must be declared before they are used

• A.

True

• B.

False

Correct Answer
A. True
Explanation
In C programming, all variables must be declared before they are used. This means that the programmer needs to specify the type and name of the variable before using it in any statements or calculations. This is necessary because the compiler needs to know the data type of the variable in order to allocate memory for it and perform appropriate operations. If a variable is used without being declared first, the compiler will generate an error. Therefore, the statement "all variable must be declared before they are used" is true in C programming.

Rate this question:

• 34.

### The file stdin has to be explicitly opened before it can be used

• A.

True

• B.

False

Correct Answer
B. False
Explanation
The statement is false because the file stdin does not need to be explicitly opened before it can be used. In most programming languages, stdin is a pre-defined file that is automatically open for reading. It is used to read input from the user or from another source. Therefore, there is no need to explicitly open it before using it.

Rate this question:

• 35.

### Array is a collection of:

• A.

Identical data objects

• B.

Different data objects

• C.

Both a and b

• D.

None of the above

Correct Answer
A. Identical data objects
Explanation
An array is a collection of identical data objects because it is a data structure that stores elements of the same type in contiguous memory locations. Each element in an array is accessed by its index, and all elements have the same data type. Therefore, an array is used to store a collection of identical data objects.

Rate this question:

• 36.

### When multidimensional array are assigned initial value:

• A.

Rightmost subscript increases most rapidly

• B.

Leftmost subscript increases most rapidly

• C.

Rightmost subscript increases least

• D.

None of the above

Correct Answer
A. Rightmost subscript increases most rapidly
Explanation
When multidimensional arrays are assigned an initial value, the rightmost subscript increases most rapidly. This means that when filling the array with values, the rightmost index changes more frequently than the other indices. For example, in a 2D array, the column index changes more rapidly than the row index. This is important to understand when accessing and manipulating elements in a multidimensional array.

Rate this question:

• 37.

### If you don't initialize a static array, what will be the elements set to?

• A.

Zero

• B.

An undetermined value

• C.

A floating point number

• D.

None of these

Correct Answer
A. Zero
Explanation
When a static array is not initialized, the elements are automatically set to zero. This means that each element in the array will have a value of zero until it is explicitly assigned a different value.

Rate this question:

• 38.

### The exit() function causes an exit from a function

• A.

True

• B.

False

Correct Answer
B. False
Explanation
The exit() function causes an exit from the entire program, not just a function. When the exit() function is called, the program terminates immediately and any remaining code in the function or program is not executed. Therefore, the statement "The exit() function causes an exit from a function" is false.

Rate this question:

• 39.

### Which option is used to print question mark

• A.

\0

• B.

\n

• C.

\?

• D.

\\

Correct Answer
A. \0
Explanation
The correct answer is \?. The backslash (\) is used as an escape character in programming languages, and when followed by certain characters, it represents a special character. In this case, the question mark (?) is a special character that needs to be printed as a regular character, so it is preceded by a backslash to indicate that it should be treated as a literal question mark. The option \0 is incorrect because it represents the null character, and \\ represents a single backslash.

Rate this question:

• 40.

### Choose the Correct one: p=5/2

• A.

1

• B.

0

• C.

2

• D.

2.5

Correct Answer
A. 1
Explanation
The correct answer is 1 because the given equation p=5/2 simplifies to p=2.5. Since 2.5 is not one of the options, the closest option to 2.5 is 2, but it is still not equal to 2.5. Therefore, the correct answer is 1, which is the closest whole number to 2.5.

Rate this question:

Quiz Review Timeline +

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

• Current Version
• Mar 20, 2023
Quiz Edited by
ProProfs Editorial Team
• Mar 06, 2020
Quiz Created by
PHULBANIOCA

Related Topics

Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.