Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

CS201 Introduction to Programming Quiz No. 01 Solution and Discussion Spring 2013 Due Date 07-05-2013

Quiz No. 1 Dated: Apr 29, 13

Dear Students Quiz No. 1 of CS201 will be started from Monday May 06, 2013 and will be closed on Tuesday May 07, 2013.

This quiz would cover from 6-11 Lectures.  No. of questions in the quiz are 10.

Views: 6197

Replies to This Discussion

1 - Application Softwares are use to

1. Type letters

2. Control computer hardware

3. Solve end user problems

4. Develop Graphics

Correct Choice : 3 From Lecture # 2

2 - Computer can do,

1. More than what we tell it

2. Less then what we tell it

3. Like human being

4. Exactly what we tell it

Correct Choice : 4 From Lecture # 2

3 - we can control our program while it is running by using

1. Debugger

2. Linker

3. Loader

4. Editor

Correct Choice : 1 From Lecture # 2

4 - _______are part of system software

1. Linker and loaders

2. Opreating System and Linker

3. Drivers

4. None of the Given

Correct Choice : 1 From Lecture # 2

5 - The remainder (%) operator is,

1. An arithmetic operator

2. A logical operator

3. A relational operator

4. A division operator

Correct Choice : 1 From Lecture # 3

6 - int x = 2 * 3 + 4 * 5; What value will x contain in the sample code above?

1. 22

2. 26

3. 46

4. 50

Correct Choice : 2 From Lecture # 3

7 - What is the correct value to return to the operating system upon the successful

completion of a program?

1. -1

2. 1

3. 0

4. Programs do not return a value.

Correct Choice : 3 From Lecture # 3

8 - What is the only function all C++ programs must contain?

1. start()

2. system()

3. main()

4. program()

Correct Choice : 3 From Lecture # 3

9 - What punctuation is used to signal the beginning and end of code blocks?

1. { }

2. - > and < -

3. BEGIN and END

4. ( and )

Correct Choice : 1 From Lecture # 3

10 - What punctuation ends most lines of C++ code?

1. (dot)

2. (semi-colon)

3. (colon)

4. (single quote)

Correct Choice : 2 From Lecture # 3

11 - Which of the following is a correct comment?

1. */ Comments */

2. ** Comment **

3. /* Comment */

4. { Comment }

Correct Choice : 3 From Lecture # 3

12 - Which of the following is not a correct variable type?

1. float

2. real

3. int

4. double

Correct Choice : 2 From Lecture # 3

13 - Which of the following is the correct operator to compare two variables?

1. :=

2. =

3. equal

4. ==

Correct Choice : 4 From Lecture # 3

14 - Identify the correct statement

1. Programmer can use comments to include short explanations within the source

code itself.

2. All lines beginning with two slash signs are considered comments.

3. Comments very important effect on the behavior of the program

4. both

Correct Choice : 2 From Lecture # 3

15 - There is a unique function in C++ program by where all C++ programs start their

execution

1. Start()

2. Begin()

3. Main()

4. Output()

Correct Choice : 3 From Lecture # 3

16 - Every statement in C++ program should end with

1. A full stop (.)

2. A Comma (,)

3. A Semicolon (;}

4. A colon (:)

Correct Choice : 3 From Lecture # 3

17 - A variable is/are

1. String that varies during program execution

2. A portion of memory to store a value

3. Those numbers that are frequently required in programs

4. None of these

Correct Choice : 3 From Lecture # 3

18 - The value of 2*15/3*7+3*2 is

1. 146

2. 76

3. 8

4. 70

Correct Choice : 2 From Lecture # 3

19 - The size of a double variable is

1. 2 bytes

2. 4 bytes

3. 8 bytes

4. 10 bytes

Correct Choice : 3 From Lecture # 3

20 - Which of the following are NOT relational operators ?

1. >

2. /p>

3. ==

4. >=

Correct Choice : 3 From Lecture # 3

21 - Which of the following can not be used as identifiers?

1. Letters

2. Digits

3. Underscores

4. Spaces

Correct Choice : 4 From Lecture # 4

22 - result of " number = number / 10; " will be equel to The " number = number % 10; "

1. TRUE

2. FALSE

3.

4.

Correct Choice : 2 From Lecture # 4

23 - int x,y =10; cout x endl; The value of the x will be in the above code

1. 0

2. 10

3. unknown Value

4. -1

Correct Choice : 3 From Lecture # 4

24 - In flow chart process is represented by

1. Rectangle

2. Arrow symbol

3. Oval

4. Circle

Correct Choice : 1 From Lecture # 5

25 - Which of the following is the boolean operator for logical-and?

1. &

2. &&

3. |

4. |&

Correct Choice : 2 From Lecture # 5

26 - Evaluate !(1 && !(0 || 1)).

1. TRUE

2. FALSE

3. Unevaluatable

4. None Of The Above

Correct Choice : 1 From Lecture # 5

27 - Which one of the following operators is a unary operator?

1. OR ( || )

2. AND ( && )

3. XOR ( ^ )

4. Logical NOT ( ! )

Correct Choice : 4 From Lecture # 5

28 - Which of the following shows the correct syntax for an if statement?

1. if expression

2. if{ expression

3. if( expression)

4. expression if

Correct Choice : 3 From Lecture # 5

29 - In if structure the block of statements is executed only,

1. Type letters

2. When it contain arithmetic operators

3. When it contain logical operators

4. When the condition is true

Correct Choice : 4 From Lecture # 6

30 - Loader transfers the executable code from main memory to hard disk.

1. TRUE

2. FALSE

3.

4.

Correct Choice : 2 From Lecture # 6

31 - What is the final value of x when the code int x; for(x=0; x < 10; x++) {} is run?

1. 10

2. 9

3. 0

4. 8

Correct Choice : 1 From Lecture # 6

32 - When does the code block following while(x< 100) execute?

1. When x is less than one hundred

2. When x is greater than one hundred

3. When x is equal to one hundred

4. While it wishes

Correct Choice : 2 From Lecture # 6

33 - Which is not a loop structure?

1. For

2. Do while

3. While

4. Repeat Until

Correct Choice : 4 From Lecture # 6

34 - for (int n=10; n >0; n++) { cout n ", "; } How many Time Loop will run

1. 100

2. Infinite Time

3. 1000

4. 10000000

Correct Choice : 2 From Lecture # 6

35 - When break statement is encountered in switch statement, it

1. Stops the entire program

2. Stops the execution of current statement

3. Exits from switch statement

4. None of the given options

Correct Choice : 3 From Lecture # 7

36 - A for loop usually consist of __________ expressions.

1. 1

2. 3

3. 2

4. 4

Correct Choice : 3 From Lecture # 7

37 - How many times is a do while loop guaranteed to loop?

1. 0

2. Variable

3. Infinitely

4. 1

Correct Choice : 4 From Lecture # 7

38 - x = x + 4 ; Is Equal to

1. x += 4 ;

2. x =+ 4 ;

3. x == 4 ;

4. x =! 4 ;

Correct Choice : 1 From Lecture # 7

39 - The first expression in a for loop is

1. The test expression.

2. The step value of the loop.

3. The first value of our counter variable.

4. None of the above.

Correct Choice : 3 From Lecture # 7

40 - What is the break statement used for ?

1. To quit the program.

2. To quit the current iteration.

3. To stop the current iteration and begin the next iteration.

4. None of the above.

Correct Choice : 2 From Lecture # 7

41 - What is the continue statement used for ?

1. To continue to the next line of code.

2. To stop the current iteration and begin the next iteration from the beginning.

3. As an alternative to the else statement.

4. None of the above.

Correct Choice : 2 From Lecture # 7

42 - What is the output of the following code? for (int a = 1; a < = 1; a++) cout a++;

cout a;

1. 22

2. 12

3. error

4. 23

Correct Choice : 2 From Lecture # 7

43 - every case statement is follows by?

1. :

2. ;

3. -

4. A newline

Correct Choice : 1 From Lecture # 8

44 - What is required to avoid falling through from one case to the next?

1. end;

2. break;

3. Stop;

4. A semicolon.

Correct Choice : 2 From Lecture # 8

45 - What keyword covers unhandled possibilities in switch case?

1. all

2. contingency

3. default

4. other

Correct Choice : 3 From Lecture # 8

46 - What is the result of the following code? x=0; switch(x) { case 1: cout "One"; case

0: cout "Zero"; case 2: cout "Hello World"; }

1. One

2. Zero

3. Hello World

4. ZeroHello World

Correct Choice : 4 From Lecture # 8

47 - Which of the following is true?

1. 1

2. -1

3. 0.1

4. All of the above

Correct Choice : 1 From Lecture # 9

48 - Every function in C++ are followed by

1. Parameters

2. Parenthesis

3. Curly braces

4. None of these

Correct Choice : 2 From Lecture # 9

49 - Which is not a proper prototype?

1. int funct(char x, char y);

2. double funct(char x)

3. void funct();

4. char x();

Correct Choice : 2 From Lecture # 9

50 - What is the return type of the function with prototype: " int func(char x, float v, double

t); "

1. char

2. int

3. float

4. double

Correct Choice : 2 From Lecture # 9

51 - Which of the following is a valid function call (assuming the function exists)?

1. funct;

2. funct x, y;

3. funct();

4. int funct();

Correct Choice : 3 From Lecture # 9

52 - Which of the following is a complete function?

1. int funct();

2. int funct(int x) {return x=x+1;}

3. void funct(int) {cout&tl; < "Hello"}

4. void funct(x) {cout "Hello"}

Correct Choice : 2 From Lecture # 9

53 - A function prototypes are useful

1. Because they tell the compiler that a function is declared later.

2. Because they make the program more readable.

3. Because they allow the programmer to see a quick list of functions in the

program along with the arguments for each function.

4. All of the above.

Correct Choice : 4 From Lecture # 9

54 - A function that calls itself is known as

1. Iterative function

2. Inline function

3. Recursive function

4. main ()

Correct Choice : 3 From Lecture # 10

55 - A preprocessor directive is identified by _________ symbol

1. #

2. {

3. (

4. ~

Correct Choice : 1 From Lecture # 10

56 - When a call to function statement is encountered,

1. The control is transfer to its Prototype

2. The control is transfer to its definition

3. The compiler stop execution of whole program

4. The program hangs

Correct Choice : 1 From Lecture # 10

57 - The directives for the preprocessors begin with

1. Less than symbol (< )

2. Ampersand symbol (&&#41;

3. Two Slashes (//)

4. Number Sign (#)

Correct Choice : 3 From Lecture # 10

58 - The file iostream includes

1. The declarations of the basic standard input-output library.

2. The streams of includes and outputs of program effect.

3. Both of these

4. None of these

Correct Choice : 1 From Lecture # 10

59 - Which of the following is false?

1. Cout represents the standard output stream in c++.

2. Cout is declared in the iostream standard file

3. Cout is declared within the std namespace

4. None of above

Correct Choice : 4 From Lecture # 10

60 - Which of the following statement is true about preprocessor directives?

1. These are lines read and processed by the preprocessor

2. They do not produce any code by themselves

3. These must be written on their own line

4. They end with a semicolon

Correct Choice : 4 From Lecture # 10

61 - If the statements int j,k; j = 123; k= 234; int* q, * r; r = &j; q=&k; cout *q ' ' *r;

are executed, what will be displayed?

1. The addresses of q and r

2. The addresses of j and k

3. 132 , 234

4. garbage values

Correct Choice : 3 From Lecture # 10

62 - If the statements int j,k; j = 123; k= 234; int* q, * r; cout *q ' ' *r; are executed,

what will be displayed?

1. The addresses of q and r

2. The addresses of j and k

3. 132 , 234

4. garbage values

Correct Choice : 4 From Lecture # 10

63 - Which of the following correctly declares an array?

1. int anarray[10];

2. int anarray;

3. anarray{10};

4. array anarray[10];

Correct Choice : 1 From Lecture # 10

64 - Which of the following correctly accesses the seventh element stored in foo, an array

with 100 elements?

1. foo[6];

2. foo[7];

3. foo(7);

4. foo;

Correct Choice : 1 From Lecture # 10

65 - Which of the following gives the memory address of the first element in array foo, an

array with 100 elements?

1. foo[0];

2. foo;

3. &foo;

4. foo[1];

Correct Choice : 2 From Lecture # 10

66 - Consider the following statement: int age [ ] = { 0, 2, 1, 3, 4, 5, 6, 7, 8, 9 }; Array

Length is

1. 10

2. 11

3. 9

4. 0

Correct Choice : 1 From Lecture # 10

67 - c[ 3 ] = 33; by this Code we are assigning the value to

1. 3rd element

2. 4th element

3. 1st element

4. None of the Given

Correct Choice : 2 From Lecture # 10

68 - for (i = 0; i < 10 ; i ++) { b[i] = a[i]; } by given loop we are ____

1. Deleting the two Arrays

2. Comparing the two Arrays

3. Copying the two arrays

4. Doing Nothing

Correct Choice : 3 From Lecture # 10

69 - int z, i ; int a [ 100 ] ; z=5; for ( i =0 ; i < 100 ; i ++ ) { a [ i ] = i ; } for ( i = 0 ; i < 100 ; i

++ ) { if ( z == a [ i ] ) { found = 1 ; break ; } } Loop will be executed for ______

1. 6 Time

2. 5 Time

3. 4 Time

4. 0 Time

Correct Choice : 1 From Lecture # 10

70 - Given that #define sum(a,b) a+b what is the value of: sum(3+1,2);

1. 18

2. 6

page 13 / 22

3. 30

4. 5*6

Correct Choice : 2 From Lecture # 10

71 - int m=0,v=0; for(m=5;m < 8;m++){ v=v+(m++)+(++m); } cout v endl; out put of

the V will be ?

1. 36

2. 11

3. 39

4. 26

Correct Choice : 2 From Lecture # 10

72 - Because of variable scope

1. Variables created in a function cannot be used another function.

2. Variables created in a function can be used in another function.

3. Variables created in a function can only be used in the main function

4. None of the above.

Correct Choice : 1 From Lecture # 10

 



CS201QuizNo.01Spring2013

See the attached file please

Attachments:

Hello freinds i have problem in arrays understanding, in lec 11 linear search what is it about. it helps to search a value assinged to an array element or the memory location where the valu is stored. plz help, will appreciate if you add me in ur skyp as "aliatvu" and explain in details. Thx

  • If we pass more than one arguments to a function then they are separated by ___________.

  • Comma ,

  • Colon :

  • Semicolon ;

  • Double quotes

When No. of repetition is known then we use the _______ structure to perform repetition tasks.

  • While loop

  • Do while loop

  • For loop

  • Switch

Function prototype is written,

  • Within main function

  • After the return statement in main

  • Before the return statement in main

    • Before call of that function

We can access a global variable ___________

  • From the functions only

  • From the loops only

  • From the main() function only

  • From anywhere in the program

A ___________ structure specifies that an action is to be repeated while some condition remains true.

  • Control

  • Logical

  • Repetition

  • Relational

_________ operator is used to pass the address of a variable in call by reference method.

  • %

  • +

  • @

  • &

Switch support_______________ data

  • Integer

  • Character

  • Float

  • Both integer and character

________ will be used for enclosing function statements into a block.

  • ""

  • ()

  • {}

  • []

What will be the size of the array declared as int array[1000];

  • 999

  • 1000

  • 1001

  • 1002

All elements of an array must be of_________ data type(s).

  • char and int

  • Same

  • Different

  • float and double

my today's quiz...

Attachments:

my today  quizzzzzzzzzzzzzz 5 miss ho gye  :::::::::::

  1. In while loop, the loop counter is initialized at ____________.
  2. Which of the function call is call by value for the following function prototype? float add(int);
  3. By default, the starting index of an array in C++ is _______.
  4. If int sum = 54; Then the value of the following statement is sum = sum - 3 ;
  5. In switch statement there can be _______ default statements.

Quiz # 1

CS201_Introduction to Programming

Question # 1 of 10 ( Start time: 08:22:02 PM ) Total Marks: 1

We can access a global variable ___________ 

Select correct option: 

From the functions only 
From the loops only 
From the main() function only 
From anywhere in the program

Question # 2 of 10 ( Start time: 08:22:28 PM ) Total Marks: 1

What will be the value of ‘a’ and ‘b’ after executing the following statements? int a = 9; int b = a++; cout< 

Select correct option: 

10,9 
9,10 
9,9 
10,10

Question # 3 of 10 ( Start time: 08:23:15 PM ) Total Marks: 1

What will be the size of following array? int arr[29]; 

Select correct option: 


30 
29 
28

Question # 4 of 10 ( Start time: 08:23:38 PM ) Total Marks: 1

All elements of an array must be of_________ data type(s). 

Select correct option: 

char and int 
Same 
Different 
float and double

Question # 5 of 10 ( Start time: 08:24:02 PM ) Total Marks: 1

While loop becomes infinite in which scenario _______. 

Select correct option: 

When the condition is always False 
When the condition is always True 
Condition contains logical operators 
Condition contains arithmetic operators

Question # 6 of 10 ( Start time: 08:24:54 PM ) Total Marks: 1

________ loop is mostly used to perform repetition of a tasks for a known number of times. 

Select correct option: 

While 
Do-While 
For 
Nested Loop

Question # 7 of 10 ( Start time: 08:25:32 PM ) Total Marks: 1

By default, the starting index of an array in C++ is _______. 

Select correct option: 


-1 
0 
1

Question # 8 of 10 ( Start time: 08:26:37 PM ) Total Marks: 1

How many times the following loop will execute? int j = 3; while(j > 0) { cout "Statements" endl; j -= 2; } 

Select correct option: 




3

Question # 9 of 10 ( Start time: 08:27:26 PM ) Total Marks: 1

The data type before a function name represents its, 

Select correct option: 

Return Type 
Function data 
Function arguments 
Function name

Question # 10 of 10 ( Start time: 08:27:56 PM ) Total Marks: 1

In loops the conditions are of ______ kind of expressions. 

Select correct option: 

Boolean expressions 
Constant expressions 
Primary expressions 
Secondary expression

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

76 
sec(s)

Question # 1 of 10 ( Start time: 07:01:54 PM )

Total Marks: 1

In call by reference, __________ of a variable is passed to the called function.

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

76 
sec(s)

Question # 2 of 10 ( Start time: 07:02:20 PM )

Total Marks: 1

A variable declared within a code block becomes ________ variable for that block.

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

41 
sec(s)

Question # 3 of 10 ( Start time: 07:02:45 PM )

Total Marks: 1

A repetition statement specifies that an action is to be continued while some_______ remains true.

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

79 
sec(s)

Question # 4 of 10 ( Start time: 07:03:43 PM )

Total Marks: 1

Which of the following loops checks the test condition at the end of the loop?

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

65 
sec(s)

Question # 5 of 10 ( Start time: 07:04:02 PM )

Total Marks: 1

If int sum = 54; Then the value of the following statement is sum = sum - 3 ;

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

45 
sec(s)

Question # 6 of 10 ( Start time: 07:04:37 PM )

Total Marks: 1

What will be the result of the expression j = i++; if initially j = 0 and i = 5?

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

75 
sec(s)

Question # 7 of 10 ( Start time: 07:05:30 PM )

Total Marks: 1

Switch statement can be used in place of _________ statement.

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

77 
sec(s)

Question # 8 of 10 ( Start time: 07:05:55 PM )

Total Marks: 1

What will be the size of the array declared as int array[1000];

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

39 
sec(s)

Question # 9 of 10 ( Start time: 07:06:17 PM )

Total Marks: 1

What is the output of the following code if the 3rd case is true switch (var) { case ‘a’: cout”apple”endl; case ‘b’: cout”banana”endl; case ‘m’: cout”mango”endl; default: cout”any fruit”endl; }

Select correct option:

 

  

MC130200678 : Tahir Mahmood 



Quiz Start Time: 07:01 PM

Time Left

78 
sec(s)

Question # 10 of 10 ( Start time: 07:07:11 PM )

Total Marks: 1

Loops are _______________ Structure

Select correct option:

 

  

 

CS201_Quiz_1_Spring_2013

See the attached file 

Attachments:

Quiz Start Time: 08:32 PM 
Time Left 83
sec(s) 
Question # 1 of 10 ( Start time: 08:32:57 PM ) Total Marks: 1
What will be the result of the expression j = i++; if initially j = 0 and i = 5?
Select correct option:
0
5
6
4




Quiz Start Time: 08:32 PM 
Time Left 85
sec(s) 
Question # 2 of 10 ( Start time: 08:34:08 PM ) Total Marks: 1
In switch statement there can be _______ default statements.
Select correct option:
1
2
3
4




Quiz Start Time: 08:32 PM 
Time Left 88
sec(s) 
Question # 3 of 10 ( Start time: 08:34:50 PM ) Total Marks: 1
In C/C++, by default arguments are passed by _______ to a function.
Select correct option:
Reference
Value
Size
Data



Quiz Start Time: 08:32 PM 
Time Left 88
sec(s) 
Question # 4 of 10 ( Start time: 08:35:51 PM ) Total Marks: 1
While loop executes at least,
Select correct option:
Zero time
One time
N Time
None of these




Quiz Start Time: 08:32 PM 
Time Left 89
sec(s) 
Question # 5 of 10 ( Start time: 08:36:33 PM ) Total Marks: 1
In C/C++; by default arguments are passed by _______ to a function.
Select correct option:
Reference
Value
Type
Data




Quiz Start Time: 08:32 PM 
Time Left 86
sec(s) 
Question # 7 of 10 ( Start time: 08:38:57 PM ) Total Marks: 1
A function’s prototype is written __________the function call.
Select correct option:
After
Before
With
At the end of



Quiz Start Time: 08:32 PM 
Time Left 88
sec(s) 
Question # 9 of 10 ( Start time: 08:40:17 PM ) Total Marks: 1
What will be the value of ‘a’ and ‘b’ after executing the following statements? int a = 9; int b = a++; cout/span>
Select correct option:
10,9
9,10
9,9
10,10




Quiz Start Time: 08:32 PM 
Time Left 85
sec(s) 
Question # 10 of 10 ( Start time: 08:40:57 PM ) Total Marks: 1
In while loop the condition is checked __________ the execution of loop.
Select correct option:
After
Before
During
At any time




Quiz Start Time: 08:32 PM 
Time Left 85
sec(s) 
Question # 6 of 10 ( Start time: 08:37:26 PM ) Total Marks: 1
What is the output of the following code? for (int i=0; i<5; i++) cout i%2 " ";
Select correct option:
0 1 2 3 4 5
0 2 4 6 8 10
0 1 0 1 0
1 0 1 0 1

CS201 solved quiz no 1 and check options

Attachments:

CS201 Introduction to Programming Quiz No. 01 Spring 2013 07-05-2013

1 - Application Softwares are use to
1. Type letters
2. Control computer hardware
3. Solve end user problems
4. Develop Graphics
Correct Choice : 3 From Lecture # 2
2 - Computer can do,
1. More than what we tell it
2. Less then what we tell it
3. Like human being
4. Exactly what we tell it
Correct Choice : 4 From Lecture # 2
3 - we can control our program while it is running by using
1. Debugger
2. Linker
3. Loader
4. Editor
Correct Choice : 1 From Lecture # 2
4 - _______are part of system software
1. Linker and loaders
2. Opreating System and Linker
3. Drivers
4. None of the Given
Correct Choice : 1 From Lecture # 2
5 - The remainder (%) operator is,
1. An arithmetic operator
2. A logical operator
3. A relational operator
4. A division operator
Correct Choice : 1 From Lecture # 3
6 - int x = 2 * 3 + 4 * 5; What value will x contain in the sample code above?
1. 22
2. 26
3. 46
4. 50
Correct Choice : 2 From Lecture # 3
7 - What is the correct value to return to the operating system upon the successful
completion of a program?
1. -1
2. 1
3. 0
4. Programs do not return a value.
Correct Choice : 3 From Lecture # 3
8 - What is the only function all C++ programs must contain?
1. start()
2. system()
3. main()
4. program()
Correct Choice : 3 From Lecture # 3
9 - What punctuation is used to signal the beginning and end of code blocks?
1. { }
2. - > and < -
3. BEGIN and END
4. ( and )
Correct Choice : 1 From Lecture # 3
10 - What punctuation ends most lines of C++ code?
1. (dot)
2. (semi-colon)
3. (colon)
4. (single quote)
Correct Choice : 2 From Lecture # 3
11 - Which of the following is a correct comment?
1. */ Comments */
2. ** Comment **
3. /* Comment */
4. { Comment }
Correct Choice : 3 From Lecture # 3
12 - Which of the following is not a correct variable type?
1. float
2. real
3. int
4. double
Correct Choice : 2 From Lecture # 3
13 - Which of the following is the correct operator to compare two variables?
1. :=
2. =
3. equal
4. ==
Correct Choice : 4 From Lecture # 3
14 - Identify the correct statement
1. Programmer can use comments to include short explanations within the source
code itself.
2. All lines beginning with two slash signs are considered comments.
3. Comments very important effect on the behavior of the program
4. both
Correct Choice : 2 From Lecture # 3
15 - There is a unique function in C++ program by where all C++ programs start their
execution
1. Start()
2. Begin()
3. Main()
4. Output()
Correct Choice : 3 From Lecture # 3
16 - Every statement in C++ program should end with
1. A full stop (.)
2. A Comma (,)
3. A Semicolon (;}
4. A colon (:)
Correct Choice : 3 From Lecture # 3
17 - A variable is/are
1. String that varies during program execution
2. A portion of memory to store a value
3. Those numbers that are frequently required in programs
4. None of these
Correct Choice : 3 From Lecture # 3
18 - The value of 2*15/3*7+3*2 is
1. 146
2. 76
3. 8
4. 70
Correct Choice : 2 From Lecture # 3
19 - The size of a double variable is
1. 2 bytes
2. 4 bytes
3. 8 bytes
4. 10 bytes
Correct Choice : 3 From Lecture # 3
20 - Which of the following are NOT relational operators ?
1. >
2. /p>
3. ==
4. >=
Correct Choice : 3 From Lecture # 3
21 - Which of the following can not be used as identifiers?
1. Letters
2. Digits
3. Underscores
4. Spaces
Correct Choice : 4 From Lecture # 4
22 - result of " number = number / 10; " will be equel to The " number = number % 10; "
1. TRUE
2. FALSE
3.
4.
Correct Choice : 2 From Lecture # 4
23 - int x,y =10; cout x endl; The value of the x will be in the above code
1. 0
2. 10
3. unknown Value
4. -1
Correct Choice : 3 From Lecture # 4
24 - In flow chart process is represented by
1. Rectangle
2. Arrow symbol
3. Oval
4. Circle
Correct Choice : 1 From Lecture # 5
25 - Which of the following is the boolean operator for logical-and?
1. &
2. &&
3. |
4. |&
Correct Choice : 2 From Lecture # 5
26 - Evaluate !(1 && !(0 || 1)).
1. TRUE
2. FALSE
3. Unevaluatable
4. None Of The Above
Correct Choice : 1 From Lecture # 5
27 - Which one of the following operators is a unary operator?
1. OR ( || )
2. AND ( && )
3. XOR ( ^ )
4. Logical NOT ( ! )
Correct Choice : 4 From Lecture # 5
28 - Which of the following shows the correct syntax for an if statement?
1. if expression
2. if{ expression
3. if( expression)
4. expression if
Correct Choice : 3 From Lecture # 5
29 - In if structure the block of statements is executed only,
1. Type letters
2. When it contain arithmetic operators
3. When it contain logical operators
4. When the condition is true
Correct Choice : 4 From Lecture # 6
30 - Loader transfers the executable code from main memory to hard disk.
1. TRUE
2. FALSE
3.
4.
Correct Choice : 2 From Lecture # 6
31 - What is the final value of x when the code int x; for(x=0; x < 10; x++) {} is run?
1. 10
2. 9
3. 0
4. 8
Correct Choice : 1 From Lecture # 6
32 - When does the code block following while(x< 100) execute?
1. When x is less than one hundred
2. When x is greater than one hundred
3. When x is equal to one hundred
4. While it wishes
Correct Choice : 2 From Lecture # 6
33 - Which is not a loop structure?
1. For
2. Do while
3. While
4. Repeat Until
Correct Choice : 4 From Lecture # 6
34 - for (int n=10; n >0; n++) { cout n ", "; } How many Time Loop will run
1. 100
2. Infinite Time
3. 1000
4. 10000000
Correct Choice : 2 From Lecture # 6
35 - When break statement is encountered in switch statement, it
1. Stops the entire program
2. Stops the execution of current statement
3. Exits from switch statement
4. None of the given options
Correct Choice : 3 From Lecture # 7
36 - A for loop usually consist of __________ expressions.
1. 1
2. 3
3. 2
4. 4
Correct Choice : 3 From Lecture # 7
37 - How many times is a do while loop guaranteed to loop?
1. 0
2. Variable
3. Infinitely
4. 1
Correct Choice : 4 From Lecture # 7
38 - x = x + 4 ; Is Equal to
1. x += 4 ;
2. x =+ 4 ;
3. x == 4 ;
4. x =! 4 ;
Correct Choice : 1 From Lecture # 7
39 - The first expression in a for loop is
1. The test expression.
2. The step value of the loop.
3. The first value of our counter variable.
4. None of the above.
Correct Choice : 3 From Lecture # 7
40 - What is the break statement used for ?
1. To quit the program.
2. To quit the current iteration.
3. To stop the current iteration and begin the next iteration.
4. None of the above.
Correct Choice : 2 From Lecture # 7
41 - What is the continue statement used for ?
1. To continue to the next line of code.
2. To stop the current iteration and begin the next iteration from the beginning.
3. As an alternative to the else statement.
4. None of the above.
Correct Choice : 2 From Lecture # 7
42 - What is the output of the following code? for (int a = 1; a < = 1; a++) cout a++;
cout a;
1. 22
2. 12
3. error
4. 23
Correct Choice : 2 From Lecture # 7
43 - every case statement is follows by?
1. :
2. ;
3. -
4. A newline
Correct Choice : 1 From Lecture # 8
44 - What is required to avoid falling through from one case to the next?
1. end;
2. break;
3. Stop;
4. A semicolon.
Correct Choice : 2 From Lecture # 8
45 - What keyword covers unhandled possibilities in switch case?
1. all
2. contingency
3. default
4. other
Correct Choice : 3 From Lecture # 8
46 - What is the result of the following code? x=0; switch(x) { case 1: cout "One"; case
0: cout "Zero"; case 2: cout "Hello World"; }
1. One
2. Zero
3. Hello World
4. ZeroHello World
Correct Choice : 4 From Lecture # 8
47 - Which of the following is true?
1. 1
2. -1
3. 0.1
4. All of the above
Correct Choice : 1 From Lecture # 9
48 - Every function in C++ are followed by
1. Parameters
2. Parenthesis
3. Curly braces
4. None of these
Correct Choice : 2 From Lecture # 9
49 - Which is not a proper prototype?
1. int funct(char x, char y);
2. double funct(char x)
3. void funct();
4. char x();
Correct Choice : 2 From Lecture # 9
50 - What is the return type of the function with prototype: " int func(char x, float v, double
t); "
1. char
2. int
3. float
4. double
Correct Choice : 2 From Lecture # 9
51 - Which of the following is a valid function call (assuming the function exists)?
1. funct;
2. funct x, y;
3. funct();
4. int funct();
Correct Choice : 3 From Lecture # 9
52 - Which of the following is a complete function?
1. int funct();
2. int funct(int x) {return x=x+1;}
3. void funct(int) {cout&tl; < "Hello"}
4. void funct(x) {cout "Hello"}
Correct Choice : 2 From Lecture # 9
53 - A function prototypes are useful
1. Because they tell the compiler that a function is declared later.
2. Because they make the program more readable.
3. Because they allow the programmer to see a quick list of functions in the
program along with the arguments for each function.
4. All of the above.
Correct Choice : 4 From Lecture # 9
54 - A function that calls itself is known as
1. Iterative function
2. Inline function
3. Recursive function
4. main ()
Correct Choice : 3 From Lecture # 10
55 - A preprocessor directive is identified by _________ symbol
1. #
2. {
3. (
4. ~
Correct Choice : 1 From Lecture # 10
56 - When a call to function statement is encountered,
1. The control is transfer to its Prototype
2. The control is transfer to its definition
3. The compiler stop execution of whole program
4. The program hangs
Correct Choice : 1 From Lecture # 10
57 - The directives for the preprocessors begin with
1. Less than symbol (< )
2. Ampersand symbol (&)
3. Two Slashes (//)
4. Number Sign (#)
Correct Choice : 3 From Lecture # 10
58 - The file iostream includes
1. The declarations of the basic standard input-output library.
2. The streams of includes and outputs of program effect.
3. Both of these
4. None of these
Correct Choice : 1 From Lecture # 10
59 - Which of the following is false?
1. Cout represents the standard output stream in c++.
2. Cout is declared in the iostream standard file
3. Cout is declared within the std namespace
4. None of above
Correct Choice : 4 From Lecture # 10
60 - Which of the following statement is true about preprocessor directives?
1. These are lines read and processed by the preprocessor
2. They do not produce any code by themselves
3. These must be written on their own line
4. They end with a semicolon
Correct Choice : 4 From Lecture # 10
61 - If the statements int j,k; j = 123; k= 234; int* q, * r; r = &j; q=&k; cout *q ' ' *r;
are executed, what will be displayed?
1. The addresses of q and r
2. The addresses of j and k
3. 132 , 234
4. garbage values
Correct Choice : 3 From Lecture # 10
62 - If the statements int j,k; j = 123; k= 234; int* q, * r; cout *q ' ' *r; are executed,
what will be displayed?
1. The addresses of q and r
2. The addresses of j and k
3. 132 , 234
4. garbage values
Correct Choice : 4 From Lecture # 10
63 - Which of the following correctly declares an array?
1. int anarray[10];
2. int anarray;
3. anarray{10};
4. array anarray[10];
Correct Choice : 1 From Lecture # 10
64 - Which of the following correctly accesses the seventh element stored in foo, an array
with 100 elements?
1. foo[6];
2. foo[7];
3. foo(7);
4. foo;
Correct Choice : 1 From Lecture # 10
65 - Which of the following gives the memory address of the first element in array foo, an
array with 100 elements?
1. foo[0];
2. foo;
3. &foo;
4. foo[1];
Correct Choice : 2 From Lecture # 10
66 - Consider the following statement: int age [ ] = { 0, 2, 1, 3, 4, 5, 6, 7, 8, 9 }; Array
Length is
1. 10
2. 11
3. 9
4. 0
Correct Choice : 1 From Lecture # 10
67 - c[ 3 ] = 33; by this Code we are assigning the value to
1. 3rd element
2. 4th element
3. 1st element
4. None of the Given
Correct Choice : 2 From Lecture # 10
68 - for (i = 0; i < 10 ; i ++) { b[i] = a[i]; } by given loop we are ____
1. Deleting the two Arrays
2. Comparing the two Arrays
3. Copying the two arrays
4. Doing Nothing
Correct Choice : 3 From Lecture # 10
69 - int z, i ; int a [ 100 ] ; z=5; for ( i =0 ; i < 100 ; i ++ ) { a [ i ] = i ; } for ( i = 0 ; i < 100 ; i
++ ) { if ( z == a [ i ] ) { found = 1 ; break ; } } Loop will be executed for ______
1. 6 Time
2. 5 Time
3. 4 Time
4. 0 Time
Correct Choice : 1 From Lecture # 10
70 - Given that #define sum(a,b) a+b what is the value of: sum(3+1,2);
1. 18
2. 6
page 13 / 22
3. 30
4. 5*6
Correct Choice : 2 From Lecture # 10
71 - int m=0,v=0; for(m=5;m < 8;m++){ v=v+(m++)+(++m); } cout v endl; out put of
the V will be ?
1. 36
2. 11
3. 39
4. 26
Correct Choice : 2 From Lecture # 10
72 - Because of variable scope
1. Variables created in a function cannot be used another function.
2. Variables created in a function can be used in another function.
3. Variables created in a function can only be used in the main function
4. None of the above.
Correct Choice : 1 From Lecture # 10 




QUIZ no 1

What is the correct syntax to declare an array of 15 elements of type float?
From the following; which one is the range of Random number generator function rand()?
When No. of repetition is known then we use the _______ structure to perform repetition tasks
Loops are _______________ Structure
When the break statement is encountered in a loop’s body, it transfers the control ________from the current loop.
By default, the starting index of an array in C++ is _______
A while loop may execute ________or more times.
In C/C++, by default arguments are passed by _______ to a function




Quizz


What is the correct syntax to declare an array of 15 elements of type float?
From the following; which one is the range of Random number generator function rand()? (0 and 32767) Ans
When No. of repetition is known then we use the _______ structure to perform repetition tasks (while loop) Ans
Loops are _______________ Structure (Repetition)Ans
When the break statement is encountered in a loop’s body, it transfers the control ________from the current loop.


Ans:
(When a break statement is encountered in a loop, the loop terminates immediately. The control exits the inner most loop if there are nested loop)
6.
By default, the starting index of an array in C++ is _______ (zero)Ans (starting point is zero and ending point is less than one)
)

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service