Quizzes
Search
Take Quizzes
Animal
Nutrition
Love
Relationship
Computer
Sports
Society
Business
Geography
Language
Personality
Harry Potter
Movie
Television
Music
Online Exam
Health
Country
Art
Entertainment
Celebrity
Math
Game
Book
Fun
Science
Food
History
Education
All Topics
Create a Quiz
Quiz Maker
Training Maker
Survey Maker
Flashcards
Brain Games
See All
ProProfs.com
Search
Create A Quiz
Take Quizzes
Animal
Nutrition
Love
Relationship
Computer
Sports
Society
Business
Geography
Language
Personality
Harry Potter
Movie
Television
Music
Online Exam
Health
Country
Art
Entertainment
Celebrity
Math
Game
Book
Fun
Science
Food
History
Education
All Topics
Products
Quiz Maker
Training Maker
Survey Maker
Flashcards
Brain Games
See All
ProProfs.com
Quizzes
Quizzes
Variable Declaration And Scope
8 Questions
|
By Jawahar Ganesh | Updated: Dec 23, 2014
| Attempts: 110
Share
Start
Share on Facebook
Share on Twitter
Share on Whatsapp
Share on Pinterest
Share on Email
Copy to Clipboard
Embed on your website
Question
1
/ 8
0 %
0/100
Score
0/100
1.
#include <stdio.h> extern int var; int main() { var = 10; printf("%d ", var); return 0; }
Compiler Error: var is not defined
20
0
Submit
Start Quiz
About This Quiz
2.
What first name or nickname would you like us to use?
You may optionally provide this to label your report, leaderboard, or certificate.
2.
Consider the following C program, which variable has the longest scope?
int a; int main() { int b; // .. // ..} int c;
A
B
C
All have same scope
Submit
3.
Output?
#include <stdio.h> int main() { int x = 1, y = 2, z = 3; printf(" x = %d, y = %d, z = %d \n", x, y, z); { int x = 10; float y = 20; printf(" x = %d, y = %f, z = %d \n", x, y, z); { int z = 100; printf(" x = %d, y = %f, z = %d \n", x, y, z); } } return 0; }
X = 1, y = 2, z = 3 x = 10, y = 20.000000, z = 3 x =...
X = 1, y = 2, z = 3 x = 10, y = 20.000000, z = 3 x = 1, y = 2, z = 100
Compiler Error
X = 1, y = 2, z = 3 x = 10, y = 20.000000, z = 3 x =...
X = 1, y = 2, z = 3 x = 10, y = 20.000000, z = 3 x = 10, y = 20.000000, z = 100
X = 1, y = 2, z = 3 x = 1, y = 2, z = 3 x =...
X = 1, y = 2, z = 3 x = 1, y = 2, z = 3 x = 1, y = 2, z = 3
Submit
4.
#include <stdio.h> extern int var = 0; int main() { var = 10; printf("%d ", var); return 0; }
10
Compiler Error: var is not defined
0
Submit
5.
Output?
int main() { { int var = 10; } { printf("%d", var); } return 0; }
10
Compiler Error
Garbage value
Submit
6.
Consider the following two C lines
int var1; extern int var2;
Which of the following statements is correct
Both statements only declare variables, don't define them
First statement declares and defines var1, but second statement only declares var2
Both statements declare define variables var1 and var2
Submit
7.
Int main() { int x = 032; printf("%d", x); return 0; }
32
0
26
50
Submit
8.
Predict the output
#include <stdio.h> int var = 20; int main() { int var = var; printf("%d ", var); return 0; }
Garbage Value
20
Compiler Error
Option 4
Submit
View My Results
Related Quizzes
Isolating The Variable- One-step Equations (Part 1)
Isolating The Variable- One-step Equations (Part 1)
Linear Equation In One Variable Quiz: Test Your Skills
Linear Equation In One Variable Quiz: Test Your Skills
Physics: Understanding Graph Relationships And Variable Manipulation
Physics: Understanding Graph Relationships And Variable Manipulation
Thank you for your feedback!
Would you like to edit this question to improve it?
No thanks
Name:
Email:
Oops! Give us more information:
Incorrect Question
Incorrect Answer
Typos
I have a feedback
Submit
Please provide name and email to proceed.
Please provide correct email to proceed.
Please provide feedback.
Please select the option.
All (8)
Unanswered (
)
Answered (
)
#include <stdio.h> extern int var; int...
Consider the following C program, which variable has the longest...
Output?#include <stdio.h> int...
#include <stdio.h> extern int var = 0; int...
Output?int...
Consider the following two C linesint var1; extern int var2;Which...
Int main() { int x =...
Predict the output#include <stdio.h> int var = 20; int...
X
OK
X
OK
Cancel
X
OK
Cancel
Advertisement