Programming and Problem Solving Quiz, Quizzes of C programming

A quiz consisting of seven multiple-choice questions related to programming and problem-solving. The questions cover topics such as control structures, arrays, loops, and output. The quiz is designed to test the knowledge of students in these areas and can be used as a study aid or as an assessment tool.

Typology: Quizzes

2022/2023

Available from 03/07/2023

ishatva_gupta4
ishatva_gupta4 🇮🇳

2 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROGRAMING AND PROBLEM SOLVING
QUIZ
1) Which loop is faster in C Language, for, while, or Do While?
a) For
b) while
c) do-while
d) All work at the same speed control structure?
2) Which among the following is an unconditional control structure?
a) Do-while
b) If-else
c) Goto
d) For
3) What is the output of this program?
int main(){
Int a[]= \{1, 2\}
int b[4] = \{1, 2, 3, 4\}
printf("%d \% d ^ 1 prime , a[0], b[0] ) ;
};
a) 12
b) 13
c) 22
d) 11
4) What is the index number of the last element of an array with 29 elements?
a) 29
b) 28
c) 0
d) Programmer-defined
5) Which of the following correctly accesses the seventh element stored in A, an array
with 100 elements?
a) A[6]
pf3

Partial preview of the text

Download Programming and Problem Solving Quiz and more Quizzes C programming in PDF only on Docsity!

PROGRAMING AND PROBLEM SOLVING

QUIZ

  1. Which loop is faster in C Language, for, while, or Do While? a) For b) while c) do-while d) All work at the same speed control structure?
  2. Which among the following is an unconditional control structure? a) Do-while b) If-else c) Goto d) For
  3. What is the output of this program? int main(){ Int a[]= {1, 2} int b[4] = {1, 2, 3, 4} printf("%d % d ^ 1 prime , a[0], b[0] ) ; }; a) 12 b) 13 c) 22 d) 11
  4. What is the index number of the last element of an array with 29 elements? a) 29 b) 28 c) 0 d) Programmer-defined 5 ) Which of the following correctly accesses the seventh element stored in A, an array with 100 elements? a) A[6]

b) A[7] c) A(7) d) A[100]

  1. What is the output? #include <stdio.h> intmain() { intarr[5]; // Assume that base address of arr is 2000 and size of integer // is 32 bit arr++; printf("%u", arr); return0; a) 2002 b) 2004 c) 2020 d) Ivalue required
  2. What is the output? #include <stdio.h> Void print(intarr[]) Intn= sizeof(arr)/sizeof(arr[0]); printf (^ prime prime 96 d^ prime prime , arr[i]); Inti; for( i = 0 0 / i <n:i++) Intmain() ntarr[]= {1, 2, 3, 4, 5, 6, 7, 8} ; print(arr); returno; a) 1, 2, 3, 4, 5, 6, 7, 8 (b) Compile error (c) 12 (d) Run time error